ws2_32: Fix TRACE format in WS_getsockname.
[wine.git] / dlls / d3d10 / effect.c
blob1dbc634123c38a675e17bcf2f937c85d044c700a
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_VERTEXSHADER:
1344 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1345 if (FAILED(hr = sv->lpVtbl->GetVertexShader(sv, variable_idx, &o->object.vs)))
1346 return hr;
1347 o->pass->vs.pShaderVariable = sv;
1348 o->pass->vs.ShaderIndex = variable_idx;
1349 break;
1352 case D3D10_EOT_PIXELSHADER:
1354 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1355 if (FAILED(hr = sv->lpVtbl->GetPixelShader(sv, variable_idx, &o->object.ps)))
1356 return hr;
1357 o->pass->ps.pShaderVariable = sv;
1358 o->pass->ps.ShaderIndex = variable_idx;
1359 break;
1362 case D3D10_EOT_GEOMETRYSHADER:
1364 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1365 if (FAILED(hr = sv->lpVtbl->GetGeometryShader(sv, variable_idx, &o->object.gs)))
1366 return hr;
1367 o->pass->gs.pShaderVariable = sv;
1368 o->pass->gs.ShaderIndex = variable_idx;
1369 break;
1372 case D3D10_EOT_RASTERIZER_STATE:
1373 case D3D10_EOT_DEPTH_STENCIL_STATE:
1374 case D3D10_EOT_BLEND_STATE:
1375 case D3D10_EOT_STENCIL_REF:
1376 case D3D10_EOT_BLEND_FACTOR:
1377 case D3D10_EOT_SAMPLE_MASK:
1378 break;
1380 default:
1381 FIXME("Unhandled object type %#x.\n", o->type);
1382 return E_FAIL;
1385 return S_OK;
1388 static HRESULT parse_fx10_pass(struct d3d10_effect_pass *p, const char **ptr, const char *data)
1390 HRESULT hr = S_OK;
1391 unsigned int i;
1392 DWORD offset;
1394 read_dword(ptr, &offset);
1395 TRACE("Pass name at offset %#x.\n", offset);
1397 if (!copy_name(data + offset, &p->name))
1399 ERR("Failed to copy name.\n");
1400 return E_OUTOFMEMORY;
1402 TRACE("Pass name: %s.\n", debugstr_a(p->name));
1404 read_dword(ptr, &p->object_count);
1405 TRACE("Pass has %u effect objects.\n", p->object_count);
1407 read_dword(ptr, &p->annotation_count);
1408 TRACE("Pass has %u annotations.\n", p->annotation_count);
1410 p->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->annotation_count * sizeof(*p->annotations));
1411 if (!p->annotations)
1413 ERR("Failed to allocate pass annotations memory.\n");
1414 return E_OUTOFMEMORY;
1417 for (i = 0; i < p->annotation_count; ++i)
1419 struct d3d10_effect_variable *a = &p->annotations[i];
1421 a->effect = p->technique->effect;
1422 a->buffer = &null_local_buffer;
1424 hr = parse_fx10_annotation(a, ptr, data);
1425 if (FAILED(hr)) return hr;
1428 p->objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->object_count * sizeof(*p->objects));
1429 if (!p->objects)
1431 ERR("Failed to allocate effect objects memory.\n");
1432 return E_OUTOFMEMORY;
1435 p->vs.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1436 p->ps.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1437 p->gs.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1439 for (i = 0; i < p->object_count; ++i)
1441 struct d3d10_effect_object *o = &p->objects[i];
1443 o->pass = p;
1445 hr = parse_fx10_object(o, ptr, data);
1446 if (FAILED(hr)) return hr;
1449 return hr;
1452 static HRESULT parse_fx10_technique(struct d3d10_effect_technique *t, const char **ptr, const char *data)
1454 unsigned int i;
1455 DWORD offset;
1456 HRESULT hr;
1458 read_dword(ptr, &offset);
1459 TRACE("Technique name at offset %#x.\n", offset);
1461 if (!copy_name(data + offset, &t->name))
1463 ERR("Failed to copy name.\n");
1464 return E_OUTOFMEMORY;
1466 TRACE("Technique name: %s.\n", debugstr_a(t->name));
1468 read_dword(ptr, &t->pass_count);
1469 TRACE("Technique has %u passes\n", t->pass_count);
1471 read_dword(ptr, &t->annotation_count);
1472 TRACE("Technique has %u annotations.\n", t->annotation_count);
1474 t->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->annotation_count * sizeof(*t->annotations));
1475 if (!t->annotations)
1477 ERR("Failed to allocate technique annotations memory.\n");
1478 return E_OUTOFMEMORY;
1481 for (i = 0; i < t->annotation_count; ++i)
1483 struct d3d10_effect_variable *a = &t->annotations[i];
1485 a->effect = t->effect;
1486 a->buffer = &null_local_buffer;
1488 hr = parse_fx10_annotation(a, ptr, data);
1489 if (FAILED(hr)) return hr;
1492 t->passes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->pass_count * sizeof(*t->passes));
1493 if (!t->passes)
1495 ERR("Failed to allocate passes memory\n");
1496 return E_OUTOFMEMORY;
1499 for (i = 0; i < t->pass_count; ++i)
1501 struct d3d10_effect_pass *p = &t->passes[i];
1503 p->ID3D10EffectPass_iface.lpVtbl = &d3d10_effect_pass_vtbl;
1504 p->technique = t;
1506 hr = parse_fx10_pass(p, ptr, data);
1507 if (FAILED(hr)) return hr;
1510 return S_OK;
1513 static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
1515 DWORD offset;
1516 unsigned int i;
1517 HRESULT hr;
1519 hr = parse_fx10_variable_head(v, ptr, data);
1520 if (FAILED(hr)) return hr;
1522 read_dword(ptr, &offset);
1523 TRACE("Variable semantic at offset %#x.\n", offset);
1525 if (!copy_name(data + offset, &v->semantic))
1527 ERR("Failed to copy semantic.\n");
1528 return E_OUTOFMEMORY;
1530 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1532 read_dword(ptr, &v->buffer_offset);
1533 TRACE("Variable offset in buffer: %#x.\n", v->buffer_offset);
1535 skip_dword_unknown("variable", ptr, 1);
1537 read_dword(ptr, &v->flag);
1538 TRACE("Variable flag: %#x.\n", v->flag);
1540 read_dword(ptr, &v->annotation_count);
1541 TRACE("Variable has %u annotations.\n", v->annotation_count);
1543 v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1544 if (!v->annotations)
1546 ERR("Failed to allocate variable annotations memory.\n");
1547 return E_OUTOFMEMORY;
1550 for (i = 0; i < v->annotation_count; ++i)
1552 struct d3d10_effect_variable *a = &v->annotations[i];
1554 a->effect = v->effect;
1555 a->buffer = &null_local_buffer;
1557 hr = parse_fx10_annotation(a, ptr, data);
1558 if (FAILED(hr)) return hr;
1561 return S_OK;
1564 static HRESULT create_state_object(struct d3d10_effect_variable *v)
1566 ID3D10Device *device = v->effect->device;
1567 HRESULT hr;
1569 switch (v->type->basetype)
1571 case D3D10_SVT_DEPTHSTENCIL:
1572 if (FAILED(hr = ID3D10Device_CreateDepthStencilState(device,
1573 &v->u.state.desc.depth_stencil, &v->u.state.object.depth_stencil)))
1574 return hr;
1575 break;
1577 case D3D10_SVT_BLEND:
1578 if (FAILED(hr = ID3D10Device_CreateBlendState(device,
1579 &v->u.state.desc.blend, &v->u.state.object.blend)))
1580 return hr;
1581 break;
1583 case D3D10_SVT_RASTERIZER:
1584 if (FAILED(hr = ID3D10Device_CreateRasterizerState(device,
1585 &v->u.state.desc.rasterizer, &v->u.state.object.rasterizer)))
1586 return hr;
1587 break;
1589 case D3D10_SVT_SAMPLER:
1590 break;
1592 default:
1593 ERR("Unhandled variable type %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1594 return E_FAIL;
1597 return S_OK;
1600 static HRESULT parse_fx10_local_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
1602 unsigned int i;
1603 HRESULT hr;
1604 DWORD offset;
1606 hr = parse_fx10_variable_head(v, ptr, data);
1607 if (FAILED(hr)) return hr;
1609 read_dword(ptr, &offset);
1610 TRACE("Variable semantic at offset %#x.\n", offset);
1612 if (!copy_name(data + offset, &v->semantic))
1614 ERR("Failed to copy semantic.\n");
1615 return E_OUTOFMEMORY;
1617 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1619 skip_dword_unknown("local variable", ptr, 1);
1621 switch (v->type->basetype)
1623 case D3D10_SVT_TEXTURE1D:
1624 case D3D10_SVT_TEXTURE1DARRAY:
1625 case D3D10_SVT_TEXTURE2D:
1626 case D3D10_SVT_TEXTURE2DARRAY:
1627 case D3D10_SVT_TEXTURE2DMS:
1628 case D3D10_SVT_TEXTURE2DMSARRAY:
1629 case D3D10_SVT_TEXTURE3D:
1630 case D3D10_SVT_TEXTURECUBE:
1631 case D3D10_SVT_RENDERTARGETVIEW:
1632 case D3D10_SVT_DEPTHSTENCILVIEW:
1633 case D3D10_SVT_BUFFER:
1634 TRACE("SVT could not have elements.\n");
1635 break;
1637 case D3D10_SVT_VERTEXSHADER:
1638 case D3D10_SVT_PIXELSHADER:
1639 case D3D10_SVT_GEOMETRYSHADER:
1640 TRACE("Shader type is %s\n", debug_d3d10_shader_variable_type(v->type->basetype));
1641 for (i = 0; i < max(v->type->element_count, 1); ++i)
1643 DWORD shader_offset;
1644 struct d3d10_effect_variable *var;
1646 if (!v->type->element_count)
1648 var = v;
1650 else
1652 var = &v->elements[i];
1655 read_dword(ptr, &shader_offset);
1656 TRACE("Shader offset: %#x.\n", shader_offset);
1658 hr = parse_shader(&var->ID3D10EffectVariable_iface, data + shader_offset);
1659 if (FAILED(hr)) return hr;
1661 break;
1663 case D3D10_SVT_DEPTHSTENCIL:
1664 case D3D10_SVT_BLEND:
1665 case D3D10_SVT_RASTERIZER:
1666 case D3D10_SVT_SAMPLER:
1668 const struct d3d10_effect_state_storage_info *storage_info;
1669 unsigned int count = max(v->type->element_count, 1);
1671 if (!(storage_info = get_storage_info(v->type->basetype)))
1673 FIXME("Failed to get backing store info for type %s.\n",
1674 debug_d3d10_shader_variable_type(v->type->basetype));
1675 return E_FAIL;
1678 if (storage_info->size > sizeof(v->u.state.desc))
1680 ERR("Invalid storage size %#lx.\n", storage_info->size);
1681 return E_FAIL;
1684 for (i = 0; i < count; ++i)
1686 struct d3d10_effect_variable *var;
1688 if (v->type->element_count)
1689 var = &v->elements[i];
1690 else
1691 var = v;
1693 memcpy(&var->u.state.desc, storage_info->default_state, storage_info->size);
1694 if (!parse_fx10_state_group(ptr, data, var->type->basetype, &var->u.state.desc))
1696 ERR("Failed to read property list.\n");
1697 return E_FAIL;
1700 if (FAILED(hr = create_state_object(v)))
1701 return hr;
1704 break;
1706 default:
1707 FIXME("Unhandled case %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1708 return E_FAIL;
1711 read_dword(ptr, &v->annotation_count);
1712 TRACE("Variable has %u annotations.\n", v->annotation_count);
1714 v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1715 if (!v->annotations)
1717 ERR("Failed to allocate variable annotations memory.\n");
1718 return E_OUTOFMEMORY;
1721 for (i = 0; i < v->annotation_count; ++i)
1723 struct d3d10_effect_variable *a = &v->annotations[i];
1725 a->effect = v->effect;
1726 a->buffer = &null_local_buffer;
1728 hr = parse_fx10_annotation(a, ptr, data);
1729 if (FAILED(hr)) return hr;
1732 return S_OK;
1735 static HRESULT parse_fx10_local_buffer(struct d3d10_effect_variable *l, const char **ptr, const char *data)
1737 unsigned int i;
1738 DWORD offset;
1739 D3D10_CBUFFER_TYPE d3d10_cbuffer_type;
1740 HRESULT hr;
1741 unsigned int stride = 0;
1743 /* Generate our own type, it isn't in the fx blob. */
1744 l->type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*l->type));
1745 if (!l->type)
1747 ERR("Failed to allocate local buffer type memory.\n");
1748 return E_OUTOFMEMORY;
1750 l->type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1751 l->type->type_class = D3D10_SVC_OBJECT;
1752 l->type->effect = l->effect;
1754 read_dword(ptr, &offset);
1755 TRACE("Local buffer name at offset %#x.\n", offset);
1757 if (!copy_name(data + offset, &l->name))
1759 ERR("Failed to copy name.\n");
1760 return E_OUTOFMEMORY;
1762 TRACE("Local buffer name: %s.\n", debugstr_a(l->name));
1764 read_dword(ptr, &l->data_size);
1765 TRACE("Local buffer data size: %#x.\n", l->data_size);
1767 read_dword(ptr, &d3d10_cbuffer_type);
1768 TRACE("Local buffer type: %#x.\n", d3d10_cbuffer_type);
1770 switch(d3d10_cbuffer_type)
1772 case D3D10_CT_CBUFFER:
1773 l->type->basetype = D3D10_SVT_CBUFFER;
1774 if (!copy_name("cbuffer", &l->type->name))
1776 ERR("Failed to copy name.\n");
1777 return E_OUTOFMEMORY;
1779 break;
1781 case D3D10_CT_TBUFFER:
1782 l->type->basetype = D3D10_SVT_TBUFFER;
1783 if (!copy_name("tbuffer", &l->type->name))
1785 ERR("Failed to copy name.\n");
1786 return E_OUTOFMEMORY;
1788 break;
1790 default:
1791 ERR("Unexpected D3D10_CBUFFER_TYPE %#x!\n", d3d10_cbuffer_type);
1792 return E_FAIL;
1795 read_dword(ptr, &l->type->member_count);
1796 TRACE("Local buffer member count: %#x.\n", l->type->member_count);
1798 skip_dword_unknown("local buffer", ptr, 1);
1800 read_dword(ptr, &l->annotation_count);
1801 TRACE("Local buffer has %u annotations.\n", l->annotation_count);
1803 l->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->annotation_count * sizeof(*l->annotations));
1804 if (!l->annotations)
1806 ERR("Failed to allocate local buffer annotations memory.\n");
1807 return E_OUTOFMEMORY;
1810 for (i = 0; i < l->annotation_count; ++i)
1812 struct d3d10_effect_variable *a = &l->annotations[i];
1814 a->effect = l->effect;
1815 a->buffer = &null_local_buffer;
1817 hr = parse_fx10_annotation(a, ptr, data);
1818 if (FAILED(hr)) return hr;
1821 l->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->members));
1822 if (!l->members)
1824 ERR("Failed to allocate members memory.\n");
1825 return E_OUTOFMEMORY;
1828 l->type->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->type->members));
1829 if (!l->type->members)
1831 ERR("Failed to allocate type members memory.\n");
1832 return E_OUTOFMEMORY;
1835 for (i = 0; i < l->type->member_count; ++i)
1837 struct d3d10_effect_variable *v = &l->members[i];
1838 struct d3d10_effect_type_member *typem = &l->type->members[i];
1840 v->buffer = l;
1841 v->effect = l->effect;
1843 hr = parse_fx10_variable(v, ptr, data);
1844 if (FAILED(hr)) return hr;
1847 * Copy the values from the variable type to the constant buffers type
1848 * members structure, because it is our own generated type.
1850 typem->type = v->type;
1852 if (!copy_name(v->name, &typem->name))
1854 ERR("Failed to copy name.\n");
1855 return E_OUTOFMEMORY;
1857 TRACE("Variable name: %s.\n", debugstr_a(typem->name));
1859 if (!copy_name(v->semantic, &typem->semantic))
1861 ERR("Failed to copy name.\n");
1862 return E_OUTOFMEMORY;
1864 TRACE("Variable semantic: %s.\n", debugstr_a(typem->semantic));
1866 typem->buffer_offset = v->buffer_offset;
1867 TRACE("Variable buffer offset: %u.\n", typem->buffer_offset);
1869 l->type->size_packed += v->type->size_packed;
1872 * For the complete constantbuffer the size_unpacked = stride,
1873 * the stride is calculated like this:
1875 * 1) if the constant buffer variables are packed with packoffset
1876 * - stride = the highest used constant
1877 * - the complete stride has to be a multiple of 0x10
1879 * 2) if the constant buffer variables are NOT packed with packoffset
1880 * - sum of unpacked size for all variables which fit in a 0x10 part
1881 * - if the size exceeds a 0x10 part, the rest of the old part is skipped
1882 * and a new part is started
1883 * - if the variable is a struct it is always used a new part
1884 * - the complete stride has to be a multiple of 0x10
1886 * e.g.:
1887 * 0x4, 0x4, 0x4, 0x8, 0x4, 0x14, 0x4
1888 * part 0x10 0x10 0x20 -> 0x40
1890 if (v->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
1892 if ((v->type->size_unpacked + v->buffer_offset) > stride)
1894 stride = v->type->size_unpacked + v->buffer_offset;
1897 else
1899 if (v->type->type_class == D3D10_SVC_STRUCT)
1901 stride = (stride + 0xf) & ~0xf;
1904 if ( ((stride & 0xf) + v->type->size_unpacked) > 0x10)
1906 stride = (stride + 0xf) & ~0xf;
1909 stride += v->type->size_unpacked;
1912 l->type->stride = l->type->size_unpacked = (stride + 0xf) & ~0xf;
1914 TRACE("Constant buffer:\n");
1915 TRACE("\tType name: %s.\n", debugstr_a(l->type->name));
1916 TRACE("\tElement count: %u.\n", l->type->element_count);
1917 TRACE("\tMember count: %u.\n", l->type->member_count);
1918 TRACE("\tUnpacked size: %#x.\n", l->type->size_unpacked);
1919 TRACE("\tStride: %#x.\n", l->type->stride);
1920 TRACE("\tPacked size %#x.\n", l->type->size_packed);
1921 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype));
1922 TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
1924 return S_OK;
1927 static int d3d10_effect_type_compare(const void *key, const struct wine_rb_entry *entry)
1929 const struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, const struct d3d10_effect_type, entry);
1930 const DWORD *id = key;
1932 return *id - t->id;
1935 static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *typem)
1937 TRACE("effect type member %p.\n", typem);
1939 /* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
1940 HeapFree(GetProcessHeap(), 0, typem->semantic);
1941 HeapFree(GetProcessHeap(), 0, typem->name);
1944 static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
1946 struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
1948 TRACE("effect type %p.\n", t);
1950 if (t->elementtype)
1952 HeapFree(GetProcessHeap(), 0, t->elementtype->name);
1953 HeapFree(GetProcessHeap(), 0, t->elementtype);
1956 if (t->members)
1958 unsigned int i;
1960 for (i = 0; i < t->member_count; ++i)
1962 d3d10_effect_type_member_destroy(&t->members[i]);
1964 HeapFree(GetProcessHeap(), 0, t->members);
1967 HeapFree(GetProcessHeap(), 0, t->name);
1968 HeapFree(GetProcessHeap(), 0, t);
1971 static const struct wine_rb_functions d3d10_effect_type_rb_functions =
1973 d3d10_rb_alloc,
1974 d3d10_rb_realloc,
1975 d3d10_rb_free,
1976 d3d10_effect_type_compare,
1979 static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
1981 const char *ptr = data + e->index_offset;
1982 unsigned int i;
1983 HRESULT hr;
1985 if (wine_rb_init(&e->types, &d3d10_effect_type_rb_functions) == -1)
1987 ERR("Failed to initialize type rbtree.\n");
1988 return E_FAIL;
1991 e->local_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_buffer_count * sizeof(*e->local_buffers));
1992 if (!e->local_buffers)
1994 ERR("Failed to allocate local buffer memory.\n");
1995 return E_OUTOFMEMORY;
1998 e->local_variables = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_variable_count * sizeof(*e->local_variables));
1999 if (!e->local_variables)
2001 ERR("Failed to allocate local variable memory.\n");
2002 return E_OUTOFMEMORY;
2005 e->anonymous_shaders = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->anonymous_shader_count * sizeof(*e->anonymous_shaders));
2006 if (!e->anonymous_shaders)
2008 ERR("Failed to allocate anonymous shaders memory\n");
2009 return E_OUTOFMEMORY;
2012 e->used_shaders = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->used_shader_count * sizeof(*e->used_shaders));
2013 if (!e->used_shaders)
2015 ERR("Failed to allocate used shaders memory\n");
2016 return E_OUTOFMEMORY;
2019 e->techniques = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->technique_count * sizeof(*e->techniques));
2020 if (!e->techniques)
2022 ERR("Failed to allocate techniques memory\n");
2023 return E_OUTOFMEMORY;
2026 for (i = 0; i < e->local_buffer_count; ++i)
2028 struct d3d10_effect_variable *l = &e->local_buffers[i];
2029 l->ID3D10EffectVariable_iface.lpVtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl;
2030 l->effect = e;
2031 l->buffer = &null_local_buffer;
2033 hr = parse_fx10_local_buffer(l, &ptr, data);
2034 if (FAILED(hr)) return hr;
2037 for (i = 0; i < e->local_variable_count; ++i)
2039 struct d3d10_effect_variable *v = &e->local_variables[i];
2041 v->effect = e;
2042 v->ID3D10EffectVariable_iface.lpVtbl = &d3d10_effect_variable_vtbl;
2043 v->buffer = &null_local_buffer;
2045 hr = parse_fx10_local_variable(v, &ptr, data);
2046 if (FAILED(hr)) return hr;
2049 for (i = 0; i < e->technique_count; ++i)
2051 struct d3d10_effect_technique *t = &e->techniques[i];
2053 t->ID3D10EffectTechnique_iface.lpVtbl = &d3d10_effect_technique_vtbl;
2054 t->effect = e;
2056 hr = parse_fx10_technique(t, &ptr, data);
2057 if (FAILED(hr)) return hr;
2060 return S_OK;
2063 static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, DWORD data_size)
2065 const char *ptr = data;
2066 DWORD unknown;
2068 /* Compiled target version (e.g. fx_4_0=0xfeff1001, fx_4_1=0xfeff1011). */
2069 read_dword(&ptr, &e->version);
2070 TRACE("Target: %#x\n", e->version);
2072 read_dword(&ptr, &e->local_buffer_count);
2073 TRACE("Local buffer count: %u.\n", e->local_buffer_count);
2075 read_dword(&ptr, &e->variable_count);
2076 TRACE("Variable count: %u\n", e->variable_count);
2078 read_dword(&ptr, &e->local_variable_count);
2079 TRACE("Object count: %u\n", e->local_variable_count);
2081 read_dword(&ptr, &e->sharedbuffers_count);
2082 TRACE("Sharedbuffers count: %u\n", e->sharedbuffers_count);
2084 /* Number of variables in shared buffers? */
2085 read_dword(&ptr, &unknown);
2086 FIXME("Unknown 0: %u\n", unknown);
2088 read_dword(&ptr, &e->sharedobjects_count);
2089 TRACE("Sharedobjects count: %u\n", e->sharedobjects_count);
2091 read_dword(&ptr, &e->technique_count);
2092 TRACE("Technique count: %u\n", e->technique_count);
2094 read_dword(&ptr, &e->index_offset);
2095 TRACE("Index offset: %#x\n", e->index_offset);
2097 read_dword(&ptr, &unknown);
2098 FIXME("Unknown 1: %u\n", unknown);
2100 read_dword(&ptr, &e->texture_count);
2101 TRACE("Texture count: %u\n", e->texture_count);
2103 read_dword(&ptr, &e->dephstencilstate_count);
2104 TRACE("Depthstencilstate count: %u\n", e->dephstencilstate_count);
2106 read_dword(&ptr, &e->blendstate_count);
2107 TRACE("Blendstate count: %u\n", e->blendstate_count);
2109 read_dword(&ptr, &e->rasterizerstate_count);
2110 TRACE("Rasterizerstate count: %u\n", e->rasterizerstate_count);
2112 read_dword(&ptr, &e->samplerstate_count);
2113 TRACE("Samplerstate count: %u\n", e->samplerstate_count);
2115 read_dword(&ptr, &e->rendertargetview_count);
2116 TRACE("Rendertargetview count: %u\n", e->rendertargetview_count);
2118 read_dword(&ptr, &e->depthstencilview_count);
2119 TRACE("Depthstencilview count: %u\n", e->depthstencilview_count);
2121 read_dword(&ptr, &e->used_shader_count);
2122 TRACE("Used shader count: %u\n", e->used_shader_count);
2124 read_dword(&ptr, &e->anonymous_shader_count);
2125 TRACE("Anonymous shader count: %u\n", e->anonymous_shader_count);
2127 return parse_fx10_body(e, ptr, data_size - (ptr - data));
2130 static HRESULT fx10_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
2132 struct d3d10_effect *e = ctx;
2134 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
2136 TRACE("chunk size: %#x\n", data_size);
2138 switch(tag)
2140 case TAG_FX10:
2141 return parse_fx10(e, data, data_size);
2143 default:
2144 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
2145 return S_OK;
2149 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size)
2151 return parse_dxbc(data, data_size, fx10_chunk_handler, This);
2154 static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
2156 ID3D10Device *device = o->pass->technique->effect->device;
2158 TRACE("effect object %p, type %#x.\n", o, o->type);
2160 switch(o->type)
2162 case D3D10_EOT_VERTEXSHADER:
2163 ID3D10Device_VSSetShader(device, o->object.vs);
2164 return S_OK;
2166 case D3D10_EOT_PIXELSHADER:
2167 ID3D10Device_PSSetShader(device, o->object.ps);
2168 return S_OK;
2170 case D3D10_EOT_GEOMETRYSHADER:
2171 ID3D10Device_GSSetShader(device, o->object.gs);
2172 return S_OK;
2174 default:
2175 FIXME("Unhandled effect object type %#x.\n", o->type);
2176 return E_FAIL;
2180 static void d3d10_effect_shader_variable_destroy(struct d3d10_effect_shader_variable *s,
2181 D3D10_SHADER_VARIABLE_TYPE type)
2183 shader_free_signature(&s->input_signature);
2184 shader_free_signature(&s->output_signature);
2186 switch (type)
2188 case D3D10_SVT_VERTEXSHADER:
2189 if (s->shader.vs)
2190 ID3D10VertexShader_Release(s->shader.vs);
2191 break;
2193 case D3D10_SVT_PIXELSHADER:
2194 if (s->shader.ps)
2195 ID3D10PixelShader_Release(s->shader.ps);
2196 break;
2198 case D3D10_SVT_GEOMETRYSHADER:
2199 if (s->shader.gs)
2200 ID3D10GeometryShader_Release(s->shader.gs);
2201 break;
2203 default:
2204 FIXME("Unhandled shader type %s.\n", debug_d3d10_shader_variable_type(type));
2205 break;
2209 static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
2211 unsigned int i;
2213 TRACE("variable %p.\n", v);
2215 HeapFree(GetProcessHeap(), 0, v->name);
2216 HeapFree(GetProcessHeap(), 0, v->semantic);
2217 if (v->annotations)
2219 for (i = 0; i < v->annotation_count; ++i)
2221 d3d10_effect_variable_destroy(&v->annotations[i]);
2223 HeapFree(GetProcessHeap(), 0, v->annotations);
2226 if (v->members)
2228 for (i = 0; i < v->type->member_count; ++i)
2230 d3d10_effect_variable_destroy(&v->members[i]);
2232 HeapFree(GetProcessHeap(), 0, v->members);
2235 if (v->elements)
2237 for (i = 0; i < v->type->element_count; ++i)
2239 d3d10_effect_variable_destroy(&v->elements[i]);
2241 HeapFree(GetProcessHeap(), 0, v->elements);
2244 switch(v->type->basetype)
2246 case D3D10_SVT_VERTEXSHADER:
2247 case D3D10_SVT_PIXELSHADER:
2248 case D3D10_SVT_GEOMETRYSHADER:
2249 d3d10_effect_shader_variable_destroy(&v->u.shader, v->type->basetype);
2250 break;
2252 default:
2253 break;
2257 static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
2259 switch (o->type)
2261 case D3D10_EOT_VERTEXSHADER:
2262 if (o->object.vs)
2263 ID3D10VertexShader_Release(o->object.vs);
2264 break;
2266 case D3D10_EOT_PIXELSHADER:
2267 if (o->object.ps)
2268 ID3D10PixelShader_Release(o->object.ps);
2269 break;
2271 case D3D10_EOT_GEOMETRYSHADER:
2272 if (o->object.gs)
2273 ID3D10GeometryShader_Release(o->object.gs);
2274 break;
2276 default:
2277 break;
2281 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
2283 unsigned int i;
2285 TRACE("pass %p\n", p);
2287 HeapFree(GetProcessHeap(), 0, p->name);
2289 if (p->objects)
2291 for (i = 0; i < p->object_count; ++i)
2293 d3d10_effect_object_destroy(&p->objects[i]);
2295 HeapFree(GetProcessHeap(), 0, p->objects);
2298 if (p->annotations)
2300 for (i = 0; i < p->annotation_count; ++i)
2302 d3d10_effect_variable_destroy(&p->annotations[i]);
2304 HeapFree(GetProcessHeap(), 0, p->annotations);
2308 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
2310 unsigned int i;
2312 TRACE("technique %p\n", t);
2314 HeapFree(GetProcessHeap(), 0, t->name);
2315 if (t->passes)
2317 for (i = 0; i < t->pass_count; ++i)
2319 d3d10_effect_pass_destroy(&t->passes[i]);
2321 HeapFree(GetProcessHeap(), 0, t->passes);
2324 if (t->annotations)
2326 for (i = 0; i < t->annotation_count; ++i)
2328 d3d10_effect_variable_destroy(&t->annotations[i]);
2330 HeapFree(GetProcessHeap(), 0, t->annotations);
2334 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
2336 unsigned int i;
2338 TRACE("local buffer %p.\n", l);
2340 HeapFree(GetProcessHeap(), 0, l->name);
2341 if (l->members)
2343 for (i = 0; i < l->type->member_count; ++i)
2345 d3d10_effect_variable_destroy(&l->members[i]);
2347 HeapFree(GetProcessHeap(), 0, l->members);
2350 if (l->type->members)
2352 for (i = 0; i < l->type->member_count; ++i)
2354 /* Do not release l->type->members[i].type, it will be covered by d3d10_effect_type_destroy(). */
2355 HeapFree(GetProcessHeap(), 0, l->type->members[i].semantic);
2356 HeapFree(GetProcessHeap(), 0, l->type->members[i].name);
2358 HeapFree(GetProcessHeap(), 0, l->type->members);
2360 HeapFree(GetProcessHeap(), 0, l->type->name);
2361 HeapFree(GetProcessHeap(), 0, l->type);
2363 if (l->annotations)
2365 for (i = 0; i < l->annotation_count; ++i)
2367 d3d10_effect_variable_destroy(&l->annotations[i]);
2369 HeapFree(GetProcessHeap(), 0, l->annotations);
2373 /* IUnknown methods */
2375 static inline struct d3d10_effect *impl_from_ID3D10Effect(ID3D10Effect *iface)
2377 return CONTAINING_RECORD(iface, struct d3d10_effect, ID3D10Effect_iface);
2380 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
2382 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
2384 if (IsEqualGUID(riid, &IID_ID3D10Effect)
2385 || IsEqualGUID(riid, &IID_IUnknown))
2387 IUnknown_AddRef(iface);
2388 *object = iface;
2389 return S_OK;
2392 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
2394 *object = NULL;
2395 return E_NOINTERFACE;
2398 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
2400 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2401 ULONG refcount = InterlockedIncrement(&This->refcount);
2403 TRACE("%p increasing refcount to %u\n", This, refcount);
2405 return refcount;
2408 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
2410 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2411 ULONG refcount = InterlockedDecrement(&This->refcount);
2413 TRACE("%p decreasing refcount to %u\n", This, refcount);
2415 if (!refcount)
2417 unsigned int i;
2419 if (This->techniques)
2421 for (i = 0; i < This->technique_count; ++i)
2423 d3d10_effect_technique_destroy(&This->techniques[i]);
2425 HeapFree(GetProcessHeap(), 0, This->techniques);
2428 if (This->local_variables)
2430 for (i = 0; i < This->local_variable_count; ++i)
2432 d3d10_effect_variable_destroy(&This->local_variables[i]);
2434 HeapFree(GetProcessHeap(), 0, This->local_variables);
2437 if (This->local_buffers)
2439 for (i = 0; i < This->local_buffer_count; ++i)
2441 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
2443 HeapFree(GetProcessHeap(), 0, This->local_buffers);
2446 if (This->anonymous_shaders)
2448 for (i = 0; i < This->anonymous_shader_count; ++i)
2450 d3d10_effect_variable_destroy(&This->anonymous_shaders[i].shader);
2451 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders[i].type.name);
2453 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders);
2456 HeapFree(GetProcessHeap(), 0, This->used_shaders);
2458 wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
2460 ID3D10Device_Release(This->device);
2461 HeapFree(GetProcessHeap(), 0, This);
2464 return refcount;
2467 /* ID3D10Effect methods */
2469 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
2471 FIXME("iface %p stub!\n", iface);
2473 return FALSE;
2476 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
2478 FIXME("iface %p stub!\n", iface);
2480 return FALSE;
2483 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
2485 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2487 TRACE("iface %p, device %p\n", iface, device);
2489 ID3D10Device_AddRef(This->device);
2490 *device = This->device;
2492 return S_OK;
2495 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
2497 FIXME("iface %p, desc %p stub!\n", iface, desc);
2499 return E_NOTIMPL;
2502 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
2503 UINT index)
2505 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2506 struct d3d10_effect_variable *l;
2508 TRACE("iface %p, index %u\n", iface, index);
2510 if (index >= This->local_buffer_count)
2512 WARN("Invalid index specified\n");
2513 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2516 l = &This->local_buffers[index];
2518 TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
2520 return (ID3D10EffectConstantBuffer *)l;
2523 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
2524 LPCSTR name)
2526 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2527 unsigned int i;
2529 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2531 for (i = 0; i < This->local_buffer_count; ++i)
2533 struct d3d10_effect_variable *l = &This->local_buffers[i];
2535 if (!strcmp(l->name, name))
2537 TRACE("Returning buffer %p.\n", l);
2538 return (ID3D10EffectConstantBuffer *)l;
2542 WARN("Invalid name specified\n");
2544 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2547 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
2549 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2550 unsigned int i;
2552 TRACE("iface %p, index %u\n", iface, index);
2554 for (i = 0; i < This->local_buffer_count; ++i)
2556 struct d3d10_effect_variable *l = &This->local_buffers[i];
2558 if (index < l->type->member_count)
2560 struct d3d10_effect_variable *v = &l->members[index];
2562 TRACE("Returning variable %p.\n", v);
2563 return &v->ID3D10EffectVariable_iface;
2565 index -= l->type->member_count;
2568 if (index < This->local_variable_count)
2570 struct d3d10_effect_variable *v = &This->local_variables[index];
2572 TRACE("Returning variable %p.\n", v);
2573 return &v->ID3D10EffectVariable_iface;
2576 WARN("Invalid index specified\n");
2578 return &null_variable.ID3D10EffectVariable_iface;
2581 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface, LPCSTR name)
2583 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2584 unsigned int i;
2586 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2588 if (!name)
2590 WARN("Invalid name specified\n");
2591 return &null_variable.ID3D10EffectVariable_iface;
2594 for (i = 0; i < This->local_buffer_count; ++i)
2596 struct d3d10_effect_variable *l = &This->local_buffers[i];
2597 unsigned int j;
2599 for (j = 0; j < l->type->member_count; ++j)
2601 struct d3d10_effect_variable *v = &l->members[j];
2603 if (!strcmp(v->name, name))
2605 TRACE("Returning variable %p.\n", v);
2606 return &v->ID3D10EffectVariable_iface;
2611 for (i = 0; i < This->local_variable_count; ++i)
2613 struct d3d10_effect_variable *v = &This->local_variables[i];
2615 if (!strcmp(v->name, name))
2617 TRACE("Returning variable %p.\n", v);
2618 return &v->ID3D10EffectVariable_iface;
2622 WARN("Invalid name specified\n");
2624 return &null_variable.ID3D10EffectVariable_iface;
2627 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
2628 LPCSTR semantic)
2630 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2631 unsigned int i;
2633 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
2635 if (!semantic)
2637 WARN("Invalid semantic specified\n");
2638 return &null_variable.ID3D10EffectVariable_iface;
2641 for (i = 0; i < This->local_buffer_count; ++i)
2643 struct d3d10_effect_variable *l = &This->local_buffers[i];
2644 unsigned int j;
2646 for (j = 0; j < l->type->member_count; ++j)
2648 struct d3d10_effect_variable *v = &l->members[j];
2650 if (!strcmp(v->semantic, semantic))
2652 TRACE("Returning variable %p.\n", v);
2653 return &v->ID3D10EffectVariable_iface;
2658 for (i = 0; i < This->local_variable_count; ++i)
2660 struct d3d10_effect_variable *v = &This->local_variables[i];
2662 if (!strcmp(v->semantic, semantic))
2664 TRACE("Returning variable %p.\n", v);
2665 return &v->ID3D10EffectVariable_iface;
2669 WARN("Invalid semantic specified\n");
2671 return &null_variable.ID3D10EffectVariable_iface;
2674 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
2675 UINT index)
2677 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2678 struct d3d10_effect_technique *t;
2680 TRACE("iface %p, index %u\n", iface, index);
2682 if (index >= This->technique_count)
2684 WARN("Invalid index specified\n");
2685 return &null_technique.ID3D10EffectTechnique_iface;
2688 t = &This->techniques[index];
2690 TRACE("Returning technique %p, %s.\n", t, debugstr_a(t->name));
2692 return &t->ID3D10EffectTechnique_iface;
2695 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
2696 LPCSTR name)
2698 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2699 unsigned int i;
2701 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2703 if (!name)
2705 WARN("Invalid name specified\n");
2706 return &null_technique.ID3D10EffectTechnique_iface;
2709 for (i = 0; i < This->technique_count; ++i)
2711 struct d3d10_effect_technique *t = &This->techniques[i];
2712 if (!strcmp(t->name, name))
2714 TRACE("Returning technique %p\n", t);
2715 return &t->ID3D10EffectTechnique_iface;
2719 WARN("Invalid name specified\n");
2721 return &null_technique.ID3D10EffectTechnique_iface;
2724 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
2726 FIXME("iface %p stub!\n", iface);
2728 return E_NOTIMPL;
2731 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
2733 FIXME("iface %p stub!\n", iface);
2735 return FALSE;
2738 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
2740 /* IUnknown methods */
2741 d3d10_effect_QueryInterface,
2742 d3d10_effect_AddRef,
2743 d3d10_effect_Release,
2744 /* ID3D10Effect methods */
2745 d3d10_effect_IsValid,
2746 d3d10_effect_IsPool,
2747 d3d10_effect_GetDevice,
2748 d3d10_effect_GetDesc,
2749 d3d10_effect_GetConstantBufferByIndex,
2750 d3d10_effect_GetConstantBufferByName,
2751 d3d10_effect_GetVariableByIndex,
2752 d3d10_effect_GetVariableByName,
2753 d3d10_effect_GetVariableBySemantic,
2754 d3d10_effect_GetTechniqueByIndex,
2755 d3d10_effect_GetTechniqueByName,
2756 d3d10_effect_Optimize,
2757 d3d10_effect_IsOptimized,
2760 /* ID3D10EffectTechnique methods */
2762 static inline struct d3d10_effect_technique *impl_from_ID3D10EffectTechnique(ID3D10EffectTechnique *iface)
2764 return CONTAINING_RECORD(iface, struct d3d10_effect_technique, ID3D10EffectTechnique_iface);
2767 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
2769 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2771 TRACE("iface %p\n", iface);
2773 return This != &null_technique;
2776 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
2777 D3D10_TECHNIQUE_DESC *desc)
2779 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2781 TRACE("iface %p, desc %p\n", iface, desc);
2783 if(This == &null_technique)
2785 WARN("Null technique specified\n");
2786 return E_FAIL;
2789 if(!desc)
2791 WARN("Invalid argument specified\n");
2792 return E_INVALIDARG;
2795 desc->Name = This->name;
2796 desc->Passes = This->pass_count;
2797 desc->Annotations = This->annotation_count;
2799 return S_OK;
2802 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
2803 ID3D10EffectTechnique *iface, UINT index)
2805 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2806 struct d3d10_effect_variable *a;
2808 TRACE("iface %p, index %u\n", iface, index);
2810 if (index >= This->annotation_count)
2812 WARN("Invalid index specified\n");
2813 return &null_variable.ID3D10EffectVariable_iface;
2816 a = &This->annotations[index];
2818 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2820 return &a->ID3D10EffectVariable_iface;
2823 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
2824 ID3D10EffectTechnique *iface, LPCSTR name)
2826 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2827 unsigned int i;
2829 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2831 for (i = 0; i < This->annotation_count; ++i)
2833 struct d3d10_effect_variable *a = &This->annotations[i];
2834 if (!strcmp(a->name, name))
2836 TRACE("Returning annotation %p\n", a);
2837 return &a->ID3D10EffectVariable_iface;
2841 WARN("Invalid name specified\n");
2843 return &null_variable.ID3D10EffectVariable_iface;
2846 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
2847 UINT index)
2849 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2850 struct d3d10_effect_pass *p;
2852 TRACE("iface %p, index %u\n", iface, index);
2854 if (index >= This->pass_count)
2856 WARN("Invalid index specified\n");
2857 return &null_pass.ID3D10EffectPass_iface;
2860 p = &This->passes[index];
2862 TRACE("Returning pass %p, %s.\n", p, debugstr_a(p->name));
2864 return &p->ID3D10EffectPass_iface;
2867 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
2868 LPCSTR name)
2870 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2871 unsigned int i;
2873 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2875 /* Do not check for name==NULL, W7/DX10 crashes in that case. */
2877 for (i = 0; i < This->pass_count; ++i)
2879 struct d3d10_effect_pass *p = &This->passes[i];
2880 if (!strcmp(p->name, name))
2882 TRACE("Returning pass %p\n", p);
2883 return &p->ID3D10EffectPass_iface;
2887 WARN("Invalid name specified\n");
2889 return &null_pass.ID3D10EffectPass_iface;
2892 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
2893 D3D10_STATE_BLOCK_MASK *mask)
2895 FIXME("iface %p,mask %p stub!\n", iface, mask);
2897 return E_NOTIMPL;
2900 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
2902 /* ID3D10EffectTechnique methods */
2903 d3d10_effect_technique_IsValid,
2904 d3d10_effect_technique_GetDesc,
2905 d3d10_effect_technique_GetAnnotationByIndex,
2906 d3d10_effect_technique_GetAnnotationByName,
2907 d3d10_effect_technique_GetPassByIndex,
2908 d3d10_effect_technique_GetPassByName,
2909 d3d10_effect_technique_ComputeStateBlockMask,
2912 /* ID3D10EffectPass methods */
2914 static inline struct d3d10_effect_pass *impl_from_ID3D10EffectPass(ID3D10EffectPass *iface)
2916 return CONTAINING_RECORD(iface, struct d3d10_effect_pass, ID3D10EffectPass_iface);
2919 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
2921 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2923 TRACE("iface %p\n", iface);
2925 return This != &null_pass;
2928 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface,
2929 D3D10_PASS_DESC *desc)
2931 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2932 struct d3d10_effect_shader_variable *s;
2934 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
2936 if(This == &null_pass)
2938 WARN("Null pass specified\n");
2939 return E_FAIL;
2942 if(!desc)
2944 WARN("Invalid argument specified\n");
2945 return E_INVALIDARG;
2948 memset(desc, 0, sizeof(*desc));
2949 desc->Name = This->name;
2951 s = &impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)This->vs.pShaderVariable)->u.shader;
2952 desc->pIAInputSignature = (BYTE *)s->input_signature.signature;
2953 desc->IAInputSignatureSize = s->input_signature.signature_size;
2955 desc->StencilRef = This->stencil_ref;
2956 desc->SampleMask = This->sample_mask;
2957 memcpy(desc->BlendFactor, This->blend_factor, 4 * sizeof(float));
2959 return S_OK;
2962 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
2963 D3D10_PASS_SHADER_DESC *desc)
2965 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2967 TRACE("iface %p, desc %p\n", iface, desc);
2969 if (This == &null_pass)
2971 WARN("Null pass specified\n");
2972 return E_FAIL;
2975 if (!desc)
2977 WARN("Invalid argument specified\n");
2978 return E_INVALIDARG;
2981 *desc = This->vs;
2983 return S_OK;
2986 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
2987 D3D10_PASS_SHADER_DESC *desc)
2989 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2991 TRACE("iface %p, desc %p\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 *desc = This->gs;
3007 return S_OK;
3010 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
3011 D3D10_PASS_SHADER_DESC *desc)
3013 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3015 TRACE("iface %p, desc %p\n", iface, desc);
3017 if (This == &null_pass)
3019 WARN("Null pass specified\n");
3020 return E_FAIL;
3023 if (!desc)
3025 WARN("Invalid argument specified\n");
3026 return E_INVALIDARG;
3029 *desc = This->ps;
3031 return S_OK;
3034 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
3035 UINT index)
3037 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3038 struct d3d10_effect_variable *a;
3040 TRACE("iface %p, index %u\n", iface, index);
3042 if (index >= This->annotation_count)
3044 WARN("Invalid index specified\n");
3045 return &null_variable.ID3D10EffectVariable_iface;
3048 a = &This->annotations[index];
3050 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3052 return &a->ID3D10EffectVariable_iface;
3055 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
3056 LPCSTR name)
3058 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3059 unsigned int i;
3061 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3063 for (i = 0; i < This->annotation_count; ++i)
3065 struct d3d10_effect_variable *a = &This->annotations[i];
3066 if (!strcmp(a->name, name))
3068 TRACE("Returning annotation %p\n", a);
3069 return &a->ID3D10EffectVariable_iface;
3073 WARN("Invalid name specified\n");
3075 return &null_variable.ID3D10EffectVariable_iface;
3078 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
3080 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3081 HRESULT hr = S_OK;
3082 unsigned int i;
3084 TRACE("iface %p, flags %#x\n", iface, flags);
3086 if (flags) FIXME("Ignoring flags (%#x)\n", flags);
3088 for (i = 0; i < This->object_count; ++i)
3090 hr = d3d10_effect_object_apply(&This->objects[i]);
3091 if (FAILED(hr)) break;
3094 return hr;
3097 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
3098 D3D10_STATE_BLOCK_MASK *mask)
3100 FIXME("iface %p, mask %p stub!\n", iface, mask);
3102 return E_NOTIMPL;
3105 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
3107 /* ID3D10EffectPass methods */
3108 d3d10_effect_pass_IsValid,
3109 d3d10_effect_pass_GetDesc,
3110 d3d10_effect_pass_GetVertexShaderDesc,
3111 d3d10_effect_pass_GetGeometryShaderDesc,
3112 d3d10_effect_pass_GetPixelShaderDesc,
3113 d3d10_effect_pass_GetAnnotationByIndex,
3114 d3d10_effect_pass_GetAnnotationByName,
3115 d3d10_effect_pass_Apply,
3116 d3d10_effect_pass_ComputeStateBlockMask,
3119 /* ID3D10EffectVariable methods */
3121 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
3123 TRACE("iface %p\n", iface);
3125 return impl_from_ID3D10EffectVariable(iface) != &null_variable;
3128 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
3130 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3132 TRACE("iface %p\n", iface);
3134 return &This->type->ID3D10EffectType_iface;
3137 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
3138 D3D10_EFFECT_VARIABLE_DESC *desc)
3140 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3142 TRACE("iface %p, desc %p\n", iface, desc);
3144 if (!iface->lpVtbl->IsValid(iface))
3146 WARN("Null variable specified\n");
3147 return E_FAIL;
3150 if (!desc)
3152 WARN("Invalid argument specified\n");
3153 return E_INVALIDARG;
3156 /* FIXME: This isn't correct. Anonymous shaders let desc->ExplicitBindPoint untouched, but normal shaders set it! */
3157 memset(desc, 0, sizeof(*desc));
3158 desc->Name = This->name;
3159 desc->Semantic = This->semantic;
3160 desc->Flags = This->flag;
3161 desc->Annotations = This->annotation_count;
3162 desc->BufferOffset = This->buffer_offset;
3164 if (This->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
3166 desc->ExplicitBindPoint = This->buffer_offset;
3169 return S_OK;
3172 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
3173 ID3D10EffectVariable *iface, UINT index)
3175 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3176 struct d3d10_effect_variable *a;
3178 TRACE("iface %p, index %u\n", iface, index);
3180 if (index >= This->annotation_count)
3182 WARN("Invalid index specified\n");
3183 return &null_variable.ID3D10EffectVariable_iface;
3186 a = &This->annotations[index];
3188 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3190 return &a->ID3D10EffectVariable_iface;
3193 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
3194 ID3D10EffectVariable *iface, LPCSTR name)
3196 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3197 unsigned int i;
3199 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3201 for (i = 0; i < This->annotation_count; ++i)
3203 struct d3d10_effect_variable *a = &This->annotations[i];
3204 if (!strcmp(a->name, name))
3206 TRACE("Returning annotation %p\n", a);
3207 return &a->ID3D10EffectVariable_iface;
3211 WARN("Invalid name specified\n");
3213 return &null_variable.ID3D10EffectVariable_iface;
3216 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
3217 ID3D10EffectVariable *iface, UINT index)
3219 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3220 struct d3d10_effect_variable *m;
3222 TRACE("iface %p, index %u\n", iface, index);
3224 if (index >= This->type->member_count)
3226 WARN("Invalid index specified\n");
3227 return &null_variable.ID3D10EffectVariable_iface;
3230 m = &This->members[index];
3232 TRACE("Returning member %p, %s\n", m, debugstr_a(m->name));
3234 return &m->ID3D10EffectVariable_iface;
3237 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
3238 ID3D10EffectVariable *iface, LPCSTR name)
3240 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3241 unsigned int i;
3243 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3245 if (!name)
3247 WARN("Invalid name specified\n");
3248 return &null_variable.ID3D10EffectVariable_iface;
3251 for (i = 0; i < This->type->member_count; ++i)
3253 struct d3d10_effect_variable *m = &This->members[i];
3255 if (m->name)
3257 if (!strcmp(m->name, name))
3259 TRACE("Returning member %p\n", m);
3260 return &m->ID3D10EffectVariable_iface;
3265 WARN("Invalid name specified\n");
3267 return &null_variable.ID3D10EffectVariable_iface;
3270 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
3271 ID3D10EffectVariable *iface, LPCSTR semantic)
3273 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3274 unsigned int i;
3276 TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic));
3278 if (!semantic)
3280 WARN("Invalid semantic specified\n");
3281 return &null_variable.ID3D10EffectVariable_iface;
3284 for (i = 0; i < This->type->member_count; ++i)
3286 struct d3d10_effect_variable *m = &This->members[i];
3288 if (m->semantic)
3290 if (!strcmp(m->semantic, semantic))
3292 TRACE("Returning member %p\n", m);
3293 return &m->ID3D10EffectVariable_iface;
3298 WARN("Invalid semantic specified\n");
3300 return &null_variable.ID3D10EffectVariable_iface;
3303 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
3304 ID3D10EffectVariable *iface, UINT index)
3306 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3307 struct d3d10_effect_variable *v;
3309 TRACE("iface %p, index %u\n", iface, index);
3311 if (index >= This->type->element_count)
3313 WARN("Invalid index specified\n");
3314 return &null_variable.ID3D10EffectVariable_iface;
3317 v = &This->elements[index];
3319 TRACE("Returning element %p, %s\n", v, debugstr_a(v->name));
3321 return &v->ID3D10EffectVariable_iface;
3324 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
3325 ID3D10EffectVariable *iface)
3327 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3329 TRACE("iface %p\n", iface);
3331 return (ID3D10EffectConstantBuffer *)This->buffer;
3334 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
3335 ID3D10EffectVariable *iface)
3337 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3339 TRACE("iface %p\n", iface);
3341 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
3342 return (ID3D10EffectScalarVariable *)&This->ID3D10EffectVariable_iface;
3344 return (ID3D10EffectScalarVariable *)&null_scalar_variable.ID3D10EffectVariable_iface;
3347 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
3348 ID3D10EffectVariable *iface)
3350 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3352 TRACE("iface %p\n", iface);
3354 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl)
3355 return (ID3D10EffectVectorVariable *)&This->ID3D10EffectVariable_iface;
3357 return (ID3D10EffectVectorVariable *)&null_vector_variable.ID3D10EffectVariable_iface;
3360 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
3361 ID3D10EffectVariable *iface)
3363 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3365 TRACE("iface %p\n", iface);
3367 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl)
3368 return (ID3D10EffectMatrixVariable *)&This->ID3D10EffectVariable_iface;
3370 return (ID3D10EffectMatrixVariable *)&null_matrix_variable.ID3D10EffectVariable_iface;
3373 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
3374 ID3D10EffectVariable *iface)
3376 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3378 TRACE("iface %p\n", iface);
3380 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl)
3381 return (ID3D10EffectStringVariable *)&This->ID3D10EffectVariable_iface;
3383 return (ID3D10EffectStringVariable *)&null_string_variable.ID3D10EffectVariable_iface;
3386 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
3387 ID3D10EffectVariable *iface)
3389 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3391 TRACE("iface %p\n", iface);
3393 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl)
3394 return (ID3D10EffectShaderResourceVariable *)&This->ID3D10EffectVariable_iface;
3396 return (ID3D10EffectShaderResourceVariable *)&null_shader_resource_variable.ID3D10EffectVariable_iface;
3399 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
3400 ID3D10EffectVariable *iface)
3402 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3404 TRACE("iface %p\n", iface);
3406 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl)
3407 return (ID3D10EffectRenderTargetViewVariable *)&This->ID3D10EffectVariable_iface;
3409 return (ID3D10EffectRenderTargetViewVariable *)&null_render_target_view_variable.ID3D10EffectVariable_iface;
3412 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
3413 ID3D10EffectVariable *iface)
3415 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3417 TRACE("iface %p\n", iface);
3419 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl)
3420 return (ID3D10EffectDepthStencilViewVariable *)&This->ID3D10EffectVariable_iface;
3422 return (ID3D10EffectDepthStencilViewVariable *)&null_depth_stencil_view_variable.ID3D10EffectVariable_iface;
3425 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
3426 ID3D10EffectVariable *iface)
3428 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3430 TRACE("iface %p\n", iface);
3432 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl)
3433 return (ID3D10EffectConstantBuffer *)&This->ID3D10EffectVariable_iface;
3435 return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface;
3438 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
3439 ID3D10EffectVariable *iface)
3441 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3443 TRACE("iface %p\n", iface);
3445 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl)
3446 return (ID3D10EffectShaderVariable *)&This->ID3D10EffectVariable_iface;
3448 return (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
3451 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
3453 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3455 TRACE("iface %p\n", iface);
3457 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl)
3458 return (ID3D10EffectBlendVariable *)&This->ID3D10EffectVariable_iface;
3460 return (ID3D10EffectBlendVariable *)&null_blend_variable.ID3D10EffectVariable_iface;
3463 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
3464 ID3D10EffectVariable *iface)
3466 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3468 TRACE("iface %p\n", iface);
3470 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl)
3471 return (ID3D10EffectDepthStencilVariable *)&This->ID3D10EffectVariable_iface;
3473 return (ID3D10EffectDepthStencilVariable *)&null_depth_stencil_variable.ID3D10EffectVariable_iface;
3476 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
3477 ID3D10EffectVariable *iface)
3479 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3481 TRACE("iface %p\n", iface);
3483 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl)
3484 return (ID3D10EffectRasterizerVariable *)&This->ID3D10EffectVariable_iface;
3486 return (ID3D10EffectRasterizerVariable *)&null_rasterizer_variable.ID3D10EffectVariable_iface;
3489 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
3490 ID3D10EffectVariable *iface)
3492 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3494 TRACE("iface %p\n", iface);
3496 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl)
3497 return (ID3D10EffectSamplerVariable *)&This->ID3D10EffectVariable_iface;
3499 return (ID3D10EffectSamplerVariable *)&null_sampler_variable.ID3D10EffectVariable_iface;
3502 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
3503 void *data, UINT offset, UINT count)
3505 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3507 return E_NOTIMPL;
3510 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
3511 void *data, UINT offset, UINT count)
3513 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3515 return E_NOTIMPL;
3518 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
3520 /* ID3D10EffectVariable methods */
3521 d3d10_effect_variable_IsValid,
3522 d3d10_effect_variable_GetType,
3523 d3d10_effect_variable_GetDesc,
3524 d3d10_effect_variable_GetAnnotationByIndex,
3525 d3d10_effect_variable_GetAnnotationByName,
3526 d3d10_effect_variable_GetMemberByIndex,
3527 d3d10_effect_variable_GetMemberByName,
3528 d3d10_effect_variable_GetMemberBySemantic,
3529 d3d10_effect_variable_GetElement,
3530 d3d10_effect_variable_GetParentConstantBuffer,
3531 d3d10_effect_variable_AsScalar,
3532 d3d10_effect_variable_AsVector,
3533 d3d10_effect_variable_AsMatrix,
3534 d3d10_effect_variable_AsString,
3535 d3d10_effect_variable_AsShaderResource,
3536 d3d10_effect_variable_AsRenderTargetView,
3537 d3d10_effect_variable_AsDepthStencilView,
3538 d3d10_effect_variable_AsConstantBuffer,
3539 d3d10_effect_variable_AsShader,
3540 d3d10_effect_variable_AsBlend,
3541 d3d10_effect_variable_AsDepthStencil,
3542 d3d10_effect_variable_AsRasterizer,
3543 d3d10_effect_variable_AsSampler,
3544 d3d10_effect_variable_SetRawValue,
3545 d3d10_effect_variable_GetRawValue,
3548 /* ID3D10EffectVariable methods */
3549 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
3551 TRACE("iface %p\n", iface);
3553 return (struct d3d10_effect_variable *)iface != &null_local_buffer;
3556 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
3558 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3561 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
3562 D3D10_EFFECT_VARIABLE_DESC *desc)
3564 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3567 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
3568 ID3D10EffectConstantBuffer *iface, UINT index)
3570 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3573 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
3574 ID3D10EffectConstantBuffer *iface, LPCSTR name)
3576 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3579 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
3580 ID3D10EffectConstantBuffer *iface, UINT index)
3582 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3585 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
3586 ID3D10EffectConstantBuffer *iface, LPCSTR name)
3588 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3591 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
3592 ID3D10EffectConstantBuffer *iface, LPCSTR semantic)
3594 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3597 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
3598 ID3D10EffectConstantBuffer *iface, UINT index)
3600 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3603 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
3604 ID3D10EffectConstantBuffer *iface)
3606 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3609 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
3610 ID3D10EffectConstantBuffer *iface)
3612 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3615 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
3616 ID3D10EffectConstantBuffer *iface)
3618 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3621 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
3622 ID3D10EffectConstantBuffer *iface)
3624 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3627 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
3628 ID3D10EffectConstantBuffer *iface)
3630 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3633 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
3634 ID3D10EffectConstantBuffer *iface)
3636 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3639 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
3640 ID3D10EffectConstantBuffer *iface)
3642 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3645 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
3646 ID3D10EffectConstantBuffer *iface)
3648 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3651 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
3652 ID3D10EffectConstantBuffer *iface)
3654 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3657 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
3658 ID3D10EffectConstantBuffer *iface)
3660 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3663 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
3665 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3668 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
3669 ID3D10EffectConstantBuffer *iface)
3671 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3674 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
3675 ID3D10EffectConstantBuffer *iface)
3677 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3680 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
3681 ID3D10EffectConstantBuffer *iface)
3683 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3686 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
3687 void *data, UINT offset, UINT count)
3689 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3692 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
3693 void *data, UINT offset, UINT count)
3695 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3698 /* ID3D10EffectConstantBuffer methods */
3699 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3700 ID3D10Buffer *buffer)
3702 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3704 return E_NOTIMPL;
3707 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3708 ID3D10Buffer **buffer)
3710 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3712 return E_NOTIMPL;
3715 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3716 ID3D10ShaderResourceView *view)
3718 FIXME("iface %p, view %p stub!\n", iface, view);
3720 return E_NOTIMPL;
3723 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3724 ID3D10ShaderResourceView **view)
3726 FIXME("iface %p, view %p stub!\n", iface, view);
3728 return E_NOTIMPL;
3731 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
3733 /* ID3D10EffectVariable methods */
3734 d3d10_effect_constant_buffer_IsValid,
3735 d3d10_effect_constant_buffer_GetType,
3736 d3d10_effect_constant_buffer_GetDesc,
3737 d3d10_effect_constant_buffer_GetAnnotationByIndex,
3738 d3d10_effect_constant_buffer_GetAnnotationByName,
3739 d3d10_effect_constant_buffer_GetMemberByIndex,
3740 d3d10_effect_constant_buffer_GetMemberByName,
3741 d3d10_effect_constant_buffer_GetMemberBySemantic,
3742 d3d10_effect_constant_buffer_GetElement,
3743 d3d10_effect_constant_buffer_GetParentConstantBuffer,
3744 d3d10_effect_constant_buffer_AsScalar,
3745 d3d10_effect_constant_buffer_AsVector,
3746 d3d10_effect_constant_buffer_AsMatrix,
3747 d3d10_effect_constant_buffer_AsString,
3748 d3d10_effect_constant_buffer_AsShaderResource,
3749 d3d10_effect_constant_buffer_AsRenderTargetView,
3750 d3d10_effect_constant_buffer_AsDepthStencilView,
3751 d3d10_effect_constant_buffer_AsConstantBuffer,
3752 d3d10_effect_constant_buffer_AsShader,
3753 d3d10_effect_constant_buffer_AsBlend,
3754 d3d10_effect_constant_buffer_AsDepthStencil,
3755 d3d10_effect_constant_buffer_AsRasterizer,
3756 d3d10_effect_constant_buffer_AsSampler,
3757 d3d10_effect_constant_buffer_SetRawValue,
3758 d3d10_effect_constant_buffer_GetRawValue,
3759 /* ID3D10EffectConstantBuffer methods */
3760 d3d10_effect_constant_buffer_SetConstantBuffer,
3761 d3d10_effect_constant_buffer_GetConstantBuffer,
3762 d3d10_effect_constant_buffer_SetTextureBuffer,
3763 d3d10_effect_constant_buffer_GetTextureBuffer,
3766 /* ID3D10EffectVariable methods */
3768 static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
3770 TRACE("iface %p\n", iface);
3772 return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
3775 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
3776 ID3D10EffectScalarVariable *iface)
3778 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3781 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
3782 D3D10_EFFECT_VARIABLE_DESC *desc)
3784 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3787 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
3788 ID3D10EffectScalarVariable *iface, UINT index)
3790 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3793 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
3794 ID3D10EffectScalarVariable *iface, LPCSTR name)
3796 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3799 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
3800 ID3D10EffectScalarVariable *iface, UINT index)
3802 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3805 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
3806 ID3D10EffectScalarVariable *iface, LPCSTR name)
3808 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3811 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
3812 ID3D10EffectScalarVariable *iface, LPCSTR semantic)
3814 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3817 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
3818 ID3D10EffectScalarVariable *iface, UINT index)
3820 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3823 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
3824 ID3D10EffectScalarVariable *iface)
3826 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3829 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
3830 ID3D10EffectScalarVariable *iface)
3832 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3835 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
3836 ID3D10EffectScalarVariable *iface)
3838 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3841 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
3842 ID3D10EffectScalarVariable *iface)
3844 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3847 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
3848 ID3D10EffectScalarVariable *iface)
3850 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3853 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
3854 ID3D10EffectScalarVariable *iface)
3856 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3859 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
3860 ID3D10EffectScalarVariable *iface)
3862 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3865 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
3866 ID3D10EffectScalarVariable *iface)
3868 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3871 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
3872 ID3D10EffectScalarVariable *iface)
3874 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3877 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
3878 ID3D10EffectScalarVariable *iface)
3880 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3883 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
3884 ID3D10EffectScalarVariable *iface)
3886 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3889 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
3890 ID3D10EffectScalarVariable *iface)
3892 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3895 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
3896 ID3D10EffectScalarVariable *iface)
3898 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3901 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
3902 ID3D10EffectScalarVariable *iface)
3904 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3907 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
3908 void *data, UINT offset, UINT count)
3910 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3913 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
3914 void *data, UINT offset, UINT count)
3916 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3919 /* ID3D10EffectScalarVariable methods */
3921 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
3922 float value)
3924 FIXME("iface %p, value %.8e stub!\n", iface, value);
3926 return E_NOTIMPL;
3929 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
3930 float *value)
3932 FIXME("iface %p, value %p stub!\n", iface, value);
3934 return E_NOTIMPL;
3937 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
3938 float *values, UINT offset, UINT count)
3940 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3942 return E_NOTIMPL;
3945 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
3946 float *values, UINT offset, UINT count)
3948 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3950 return E_NOTIMPL;
3953 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetInt(ID3D10EffectScalarVariable *iface,
3954 int value)
3956 FIXME("iface %p, value %d stub!\n", iface, value);
3958 return E_NOTIMPL;
3961 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
3962 int *value)
3964 FIXME("iface %p, value %p stub!\n", iface, value);
3966 return E_NOTIMPL;
3969 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
3970 int *values, UINT offset, UINT count)
3972 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3974 return E_NOTIMPL;
3977 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
3978 int *values, UINT offset, UINT count)
3980 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3982 return E_NOTIMPL;
3985 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
3986 BOOL value)
3988 FIXME("iface %p, value %d stub!\n", iface, value);
3990 return E_NOTIMPL;
3993 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
3994 BOOL *value)
3996 FIXME("iface %p, value %p stub!\n", iface, value);
3998 return E_NOTIMPL;
4001 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
4002 BOOL *values, UINT offset, UINT count)
4004 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4006 return E_NOTIMPL;
4009 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
4010 BOOL *values, UINT offset, UINT count)
4012 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4014 return E_NOTIMPL;
4017 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
4019 /* ID3D10EffectVariable methods */
4020 d3d10_effect_scalar_variable_IsValid,
4021 d3d10_effect_scalar_variable_GetType,
4022 d3d10_effect_scalar_variable_GetDesc,
4023 d3d10_effect_scalar_variable_GetAnnotationByIndex,
4024 d3d10_effect_scalar_variable_GetAnnotationByName,
4025 d3d10_effect_scalar_variable_GetMemberByIndex,
4026 d3d10_effect_scalar_variable_GetMemberByName,
4027 d3d10_effect_scalar_variable_GetMemberBySemantic,
4028 d3d10_effect_scalar_variable_GetElement,
4029 d3d10_effect_scalar_variable_GetParentConstantBuffer,
4030 d3d10_effect_scalar_variable_AsScalar,
4031 d3d10_effect_scalar_variable_AsVector,
4032 d3d10_effect_scalar_variable_AsMatrix,
4033 d3d10_effect_scalar_variable_AsString,
4034 d3d10_effect_scalar_variable_AsShaderResource,
4035 d3d10_effect_scalar_variable_AsRenderTargetView,
4036 d3d10_effect_scalar_variable_AsDepthStencilView,
4037 d3d10_effect_scalar_variable_AsConstantBuffer,
4038 d3d10_effect_scalar_variable_AsShader,
4039 d3d10_effect_scalar_variable_AsBlend,
4040 d3d10_effect_scalar_variable_AsDepthStencil,
4041 d3d10_effect_scalar_variable_AsRasterizer,
4042 d3d10_effect_scalar_variable_AsSampler,
4043 d3d10_effect_scalar_variable_SetRawValue,
4044 d3d10_effect_scalar_variable_GetRawValue,
4045 /* ID3D10EffectScalarVariable methods */
4046 d3d10_effect_scalar_variable_SetFloat,
4047 d3d10_effect_scalar_variable_GetFloat,
4048 d3d10_effect_scalar_variable_SetFloatArray,
4049 d3d10_effect_scalar_variable_GetFloatArray,
4050 d3d10_effect_scalar_variable_SetInt,
4051 d3d10_effect_scalar_variable_GetInt,
4052 d3d10_effect_scalar_variable_SetIntArray,
4053 d3d10_effect_scalar_variable_GetIntArray,
4054 d3d10_effect_scalar_variable_SetBool,
4055 d3d10_effect_scalar_variable_GetBool,
4056 d3d10_effect_scalar_variable_SetBoolArray,
4057 d3d10_effect_scalar_variable_GetBoolArray,
4060 /* ID3D10EffectVariable methods */
4062 static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
4064 TRACE("iface %p\n", iface);
4066 return (struct d3d10_effect_variable *)iface != &null_vector_variable;
4069 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetType(
4070 ID3D10EffectVectorVariable *iface)
4072 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4075 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetDesc(ID3D10EffectVectorVariable *iface,
4076 D3D10_EFFECT_VARIABLE_DESC *desc)
4078 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4081 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByIndex(
4082 ID3D10EffectVectorVariable *iface, UINT index)
4084 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4087 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByName(
4088 ID3D10EffectVectorVariable *iface, LPCSTR name)
4090 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4093 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByIndex(
4094 ID3D10EffectVectorVariable *iface, UINT index)
4096 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4099 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByName(
4100 ID3D10EffectVectorVariable *iface, LPCSTR name)
4102 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4105 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberBySemantic(
4106 ID3D10EffectVectorVariable *iface, LPCSTR semantic)
4108 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4111 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetElement(
4112 ID3D10EffectVectorVariable *iface, UINT index)
4114 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4117 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetParentConstantBuffer(
4118 ID3D10EffectVectorVariable *iface)
4120 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4123 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsScalar(
4124 ID3D10EffectVectorVariable *iface)
4126 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4129 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsVector(
4130 ID3D10EffectVectorVariable *iface)
4132 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4135 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsMatrix(
4136 ID3D10EffectVectorVariable *iface)
4138 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4141 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsString(
4142 ID3D10EffectVectorVariable *iface)
4144 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4147 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShaderResource(
4148 ID3D10EffectVectorVariable *iface)
4150 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4153 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRenderTargetView(
4154 ID3D10EffectVectorVariable *iface)
4156 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4159 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencilView(
4160 ID3D10EffectVectorVariable *iface)
4162 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4165 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsConstantBuffer(
4166 ID3D10EffectVectorVariable *iface)
4168 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4171 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShader(
4172 ID3D10EffectVectorVariable *iface)
4174 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4177 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsBlend(
4178 ID3D10EffectVectorVariable *iface)
4180 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4183 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencil(
4184 ID3D10EffectVectorVariable *iface)
4186 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4189 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRasterizer(
4190 ID3D10EffectVectorVariable *iface)
4192 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4195 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsSampler(
4196 ID3D10EffectVectorVariable *iface)
4198 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4201 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetRawValue(ID3D10EffectVectorVariable *iface,
4202 void *data, UINT offset, UINT count)
4204 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4207 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetRawValue(ID3D10EffectVectorVariable *iface,
4208 void *data, UINT offset, UINT count)
4210 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4213 /* ID3D10EffectVectorVariable methods */
4215 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVector(ID3D10EffectVectorVariable *iface,
4216 BOOL *value)
4218 FIXME("iface %p, value %p stub!\n", iface, value);
4220 return E_NOTIMPL;
4223 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVector(ID3D10EffectVectorVariable *iface,
4224 int *value)
4226 FIXME("iface %p, value %p stub!\n", iface, value);
4228 return E_NOTIMPL;
4231 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVector(ID3D10EffectVectorVariable *iface,
4232 float *value)
4234 FIXME("iface %p, value %p stub!\n", iface, value);
4236 return E_NOTIMPL;
4239 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVector(ID3D10EffectVectorVariable *iface,
4240 BOOL *value)
4242 FIXME("iface %p, value %p stub!\n", iface, value);
4244 return E_NOTIMPL;
4247 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVector(ID3D10EffectVectorVariable *iface,
4248 int *value)
4250 FIXME("iface %p, value %p stub!\n", iface, value);
4252 return E_NOTIMPL;
4255 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVector(ID3D10EffectVectorVariable *iface,
4256 float *value)
4258 FIXME("iface %p, value %p stub!\n", iface, value);
4260 return E_NOTIMPL;
4263 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4264 BOOL *values, UINT offset, UINT count)
4266 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4268 return E_NOTIMPL;
4271 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVectorArray(ID3D10EffectVectorVariable *iface,
4272 int *values, UINT offset, UINT count)
4274 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4276 return E_NOTIMPL;
4279 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4280 float *values, UINT offset, UINT count)
4282 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4284 return E_NOTIMPL;
4287 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4288 BOOL *values, UINT offset, UINT count)
4290 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4292 return E_NOTIMPL;
4295 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVectorArray(ID3D10EffectVectorVariable *iface,
4296 int *values, UINT offset, UINT count)
4298 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4300 return E_NOTIMPL;
4303 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4304 float *values, UINT offset, UINT count)
4306 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4308 return E_NOTIMPL;
4311 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl =
4313 /* ID3D10EffectVariable methods */
4314 d3d10_effect_vector_variable_IsValid,
4315 d3d10_effect_vector_variable_GetType,
4316 d3d10_effect_vector_variable_GetDesc,
4317 d3d10_effect_vector_variable_GetAnnotationByIndex,
4318 d3d10_effect_vector_variable_GetAnnotationByName,
4319 d3d10_effect_vector_variable_GetMemberByIndex,
4320 d3d10_effect_vector_variable_GetMemberByName,
4321 d3d10_effect_vector_variable_GetMemberBySemantic,
4322 d3d10_effect_vector_variable_GetElement,
4323 d3d10_effect_vector_variable_GetParentConstantBuffer,
4324 d3d10_effect_vector_variable_AsScalar,
4325 d3d10_effect_vector_variable_AsVector,
4326 d3d10_effect_vector_variable_AsMatrix,
4327 d3d10_effect_vector_variable_AsString,
4328 d3d10_effect_vector_variable_AsShaderResource,
4329 d3d10_effect_vector_variable_AsRenderTargetView,
4330 d3d10_effect_vector_variable_AsDepthStencilView,
4331 d3d10_effect_vector_variable_AsConstantBuffer,
4332 d3d10_effect_vector_variable_AsShader,
4333 d3d10_effect_vector_variable_AsBlend,
4334 d3d10_effect_vector_variable_AsDepthStencil,
4335 d3d10_effect_vector_variable_AsRasterizer,
4336 d3d10_effect_vector_variable_AsSampler,
4337 d3d10_effect_vector_variable_SetRawValue,
4338 d3d10_effect_vector_variable_GetRawValue,
4339 /* ID3D10EffectVectorVariable methods */
4340 d3d10_effect_vector_variable_SetBoolVector,
4341 d3d10_effect_vector_variable_SetIntVector,
4342 d3d10_effect_vector_variable_SetFloatVector,
4343 d3d10_effect_vector_variable_GetBoolVector,
4344 d3d10_effect_vector_variable_GetIntVector,
4345 d3d10_effect_vector_variable_GetFloatVector,
4346 d3d10_effect_vector_variable_SetBoolVectorArray,
4347 d3d10_effect_vector_variable_SetIntVectorArray,
4348 d3d10_effect_vector_variable_SetFloatVectorArray,
4349 d3d10_effect_vector_variable_GetBoolVectorArray,
4350 d3d10_effect_vector_variable_GetIntVectorArray,
4351 d3d10_effect_vector_variable_GetFloatVectorArray,
4354 /* ID3D10EffectVariable methods */
4356 static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
4358 TRACE("iface %p\n", iface);
4360 return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
4363 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
4364 ID3D10EffectMatrixVariable *iface)
4366 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4369 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
4370 D3D10_EFFECT_VARIABLE_DESC *desc)
4372 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4375 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
4376 ID3D10EffectMatrixVariable *iface, UINT index)
4378 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4381 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
4382 ID3D10EffectMatrixVariable *iface, LPCSTR name)
4384 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4387 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
4388 ID3D10EffectMatrixVariable *iface, UINT index)
4390 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4393 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
4394 ID3D10EffectMatrixVariable *iface, LPCSTR name)
4396 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4399 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
4400 ID3D10EffectMatrixVariable *iface, LPCSTR semantic)
4402 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4405 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
4406 ID3D10EffectMatrixVariable *iface, UINT index)
4408 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4411 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
4412 ID3D10EffectMatrixVariable *iface)
4414 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4417 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
4418 ID3D10EffectMatrixVariable *iface)
4420 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4423 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
4424 ID3D10EffectMatrixVariable *iface)
4426 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4429 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
4430 ID3D10EffectMatrixVariable *iface)
4432 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4435 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
4436 ID3D10EffectMatrixVariable *iface)
4438 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4441 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
4442 ID3D10EffectMatrixVariable *iface)
4444 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4447 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
4448 ID3D10EffectMatrixVariable *iface)
4450 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4453 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
4454 ID3D10EffectMatrixVariable *iface)
4456 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4459 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
4460 ID3D10EffectMatrixVariable *iface)
4462 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4465 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
4466 ID3D10EffectMatrixVariable *iface)
4468 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4471 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
4472 ID3D10EffectMatrixVariable *iface)
4474 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4477 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
4478 ID3D10EffectMatrixVariable *iface)
4480 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4483 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
4484 ID3D10EffectMatrixVariable *iface)
4486 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4489 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
4490 ID3D10EffectMatrixVariable *iface)
4492 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4495 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
4496 void *data, UINT offset, UINT count)
4498 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4501 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
4502 void *data, UINT offset, UINT count)
4504 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4507 /* ID3D10EffectMatrixVariable methods */
4509 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
4510 float *data)
4512 FIXME("iface %p, data %p stub!\n", iface, data);
4514 return E_NOTIMPL;
4517 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
4518 float *data)
4520 FIXME("iface %p, data %p stub!\n", iface, data);
4522 return E_NOTIMPL;
4525 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
4526 float *data, UINT offset, UINT count)
4528 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4530 return E_NOTIMPL;
4533 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
4534 float *data, UINT offset, UINT count)
4536 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4538 return E_NOTIMPL;
4541 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4542 float *data)
4544 FIXME("iface %p, data %p stub!\n", iface, data);
4546 return E_NOTIMPL;
4549 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4550 float *data)
4552 FIXME("iface %p, data %p stub!\n", iface, data);
4554 return E_NOTIMPL;
4557 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4558 float *data, UINT offset, UINT count)
4560 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4562 return E_NOTIMPL;
4565 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4566 float *data, UINT offset, UINT count)
4568 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4570 return E_NOTIMPL;
4574 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
4576 /* ID3D10EffectVariable methods */
4577 d3d10_effect_matrix_variable_IsValid,
4578 d3d10_effect_matrix_variable_GetType,
4579 d3d10_effect_matrix_variable_GetDesc,
4580 d3d10_effect_matrix_variable_GetAnnotationByIndex,
4581 d3d10_effect_matrix_variable_GetAnnotationByName,
4582 d3d10_effect_matrix_variable_GetMemberByIndex,
4583 d3d10_effect_matrix_variable_GetMemberByName,
4584 d3d10_effect_matrix_variable_GetMemberBySemantic,
4585 d3d10_effect_matrix_variable_GetElement,
4586 d3d10_effect_matrix_variable_GetParentConstantBuffer,
4587 d3d10_effect_matrix_variable_AsScalar,
4588 d3d10_effect_matrix_variable_AsVector,
4589 d3d10_effect_matrix_variable_AsMatrix,
4590 d3d10_effect_matrix_variable_AsString,
4591 d3d10_effect_matrix_variable_AsShaderResource,
4592 d3d10_effect_matrix_variable_AsRenderTargetView,
4593 d3d10_effect_matrix_variable_AsDepthStencilView,
4594 d3d10_effect_matrix_variable_AsConstantBuffer,
4595 d3d10_effect_matrix_variable_AsShader,
4596 d3d10_effect_matrix_variable_AsBlend,
4597 d3d10_effect_matrix_variable_AsDepthStencil,
4598 d3d10_effect_matrix_variable_AsRasterizer,
4599 d3d10_effect_matrix_variable_AsSampler,
4600 d3d10_effect_matrix_variable_SetRawValue,
4601 d3d10_effect_matrix_variable_GetRawValue,
4602 /* ID3D10EffectMatrixVariable methods */
4603 d3d10_effect_matrix_variable_SetMatrix,
4604 d3d10_effect_matrix_variable_GetMatrix,
4605 d3d10_effect_matrix_variable_SetMatrixArray,
4606 d3d10_effect_matrix_variable_GetMatrixArray,
4607 d3d10_effect_matrix_variable_SetMatrixTranspose,
4608 d3d10_effect_matrix_variable_GetMatrixTranspose,
4609 d3d10_effect_matrix_variable_SetMatrixTransposeArray,
4610 d3d10_effect_matrix_variable_GetMatrixTransposeArray,
4613 /* ID3D10EffectVariable methods */
4615 static BOOL STDMETHODCALLTYPE d3d10_effect_string_variable_IsValid(ID3D10EffectStringVariable *iface)
4617 TRACE("iface %p\n", iface);
4619 return (struct d3d10_effect_variable *)iface != &null_string_variable;
4622 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_string_variable_GetType(
4623 ID3D10EffectStringVariable *iface)
4625 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4628 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetDesc(ID3D10EffectStringVariable *iface,
4629 D3D10_EFFECT_VARIABLE_DESC *desc)
4631 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4634 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByIndex(
4635 ID3D10EffectStringVariable *iface, UINT index)
4637 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4640 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByName(
4641 ID3D10EffectStringVariable *iface, LPCSTR name)
4643 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4646 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByIndex(
4647 ID3D10EffectStringVariable *iface, UINT index)
4649 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4652 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByName(
4653 ID3D10EffectStringVariable *iface, LPCSTR name)
4655 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4658 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberBySemantic(
4659 ID3D10EffectStringVariable *iface, LPCSTR semantic)
4661 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4664 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetElement(
4665 ID3D10EffectStringVariable *iface, UINT index)
4667 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4670 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_GetParentConstantBuffer(
4671 ID3D10EffectStringVariable *iface)
4673 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4676 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsScalar(
4677 ID3D10EffectStringVariable *iface)
4679 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4682 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsVector(
4683 ID3D10EffectStringVariable *iface)
4685 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4688 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsMatrix(
4689 ID3D10EffectStringVariable *iface)
4691 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4694 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsString(
4695 ID3D10EffectStringVariable *iface)
4697 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4700 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShaderResource(
4701 ID3D10EffectStringVariable *iface)
4703 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4706 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRenderTargetView(
4707 ID3D10EffectStringVariable *iface)
4709 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4712 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencilView(
4713 ID3D10EffectStringVariable *iface)
4715 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4718 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_AsConstantBuffer(
4719 ID3D10EffectStringVariable *iface)
4721 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4724 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShader(
4725 ID3D10EffectStringVariable *iface)
4727 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4730 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsBlend(
4731 ID3D10EffectStringVariable *iface)
4733 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4736 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencil(
4737 ID3D10EffectStringVariable *iface)
4739 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4742 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRasterizer(
4743 ID3D10EffectStringVariable *iface)
4745 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4748 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsSampler(
4749 ID3D10EffectStringVariable *iface)
4751 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4754 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_SetRawValue(ID3D10EffectStringVariable *iface,
4755 void *data, UINT offset, UINT count)
4757 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4760 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetRawValue(ID3D10EffectStringVariable *iface,
4761 void *data, UINT offset, UINT count)
4763 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4766 /* ID3D10EffectStringVariable methods */
4768 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetString(ID3D10EffectStringVariable *iface,
4769 LPCSTR *str)
4771 FIXME("iface %p, str %p stub!\n", iface, str);
4773 return E_NOTIMPL;
4776 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetStringArray(ID3D10EffectStringVariable *iface,
4777 LPCSTR *strs, UINT offset, UINT count)
4779 FIXME("iface %p, strs %p, offset %u, count %u stub!\n", iface, strs, offset, count);
4781 return E_NOTIMPL;
4785 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl =
4787 /* ID3D10EffectVariable methods */
4788 d3d10_effect_string_variable_IsValid,
4789 d3d10_effect_string_variable_GetType,
4790 d3d10_effect_string_variable_GetDesc,
4791 d3d10_effect_string_variable_GetAnnotationByIndex,
4792 d3d10_effect_string_variable_GetAnnotationByName,
4793 d3d10_effect_string_variable_GetMemberByIndex,
4794 d3d10_effect_string_variable_GetMemberByName,
4795 d3d10_effect_string_variable_GetMemberBySemantic,
4796 d3d10_effect_string_variable_GetElement,
4797 d3d10_effect_string_variable_GetParentConstantBuffer,
4798 d3d10_effect_string_variable_AsScalar,
4799 d3d10_effect_string_variable_AsVector,
4800 d3d10_effect_string_variable_AsMatrix,
4801 d3d10_effect_string_variable_AsString,
4802 d3d10_effect_string_variable_AsShaderResource,
4803 d3d10_effect_string_variable_AsRenderTargetView,
4804 d3d10_effect_string_variable_AsDepthStencilView,
4805 d3d10_effect_string_variable_AsConstantBuffer,
4806 d3d10_effect_string_variable_AsShader,
4807 d3d10_effect_string_variable_AsBlend,
4808 d3d10_effect_string_variable_AsDepthStencil,
4809 d3d10_effect_string_variable_AsRasterizer,
4810 d3d10_effect_string_variable_AsSampler,
4811 d3d10_effect_string_variable_SetRawValue,
4812 d3d10_effect_string_variable_GetRawValue,
4813 /* ID3D10EffectStringVariable methods */
4814 d3d10_effect_string_variable_GetString,
4815 d3d10_effect_string_variable_GetStringArray,
4818 /* ID3D10EffectVariable methods */
4820 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_IsValid(ID3D10EffectShaderResourceVariable *iface)
4822 TRACE("iface %p\n", iface);
4824 return (struct d3d10_effect_variable *)iface != &null_shader_resource_variable;
4827 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetType(
4828 ID3D10EffectShaderResourceVariable *iface)
4830 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4833 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetDesc(
4834 ID3D10EffectShaderResourceVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
4836 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4839 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByIndex(
4840 ID3D10EffectShaderResourceVariable *iface, UINT index)
4842 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4845 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByName(
4846 ID3D10EffectShaderResourceVariable *iface, LPCSTR name)
4848 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4851 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByIndex(
4852 ID3D10EffectShaderResourceVariable *iface, UINT index)
4854 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4857 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByName(
4858 ID3D10EffectShaderResourceVariable *iface, LPCSTR name)
4860 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4863 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberBySemantic(
4864 ID3D10EffectShaderResourceVariable *iface, LPCSTR semantic)
4866 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4869 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetElement(
4870 ID3D10EffectShaderResourceVariable *iface, UINT index)
4872 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4875 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetParentConstantBuffer(
4876 ID3D10EffectShaderResourceVariable *iface)
4878 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4881 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsScalar(
4882 ID3D10EffectShaderResourceVariable *iface)
4884 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4887 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsVector(
4888 ID3D10EffectShaderResourceVariable *iface)
4890 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4893 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsMatrix(
4894 ID3D10EffectShaderResourceVariable *iface)
4896 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4899 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsString(
4900 ID3D10EffectShaderResourceVariable *iface)
4902 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4905 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShaderResource(
4906 ID3D10EffectShaderResourceVariable *iface)
4908 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4911 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRenderTargetView(
4912 ID3D10EffectShaderResourceVariable *iface)
4914 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4917 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencilView(
4918 ID3D10EffectShaderResourceVariable *iface)
4920 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4923 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsConstantBuffer(
4924 ID3D10EffectShaderResourceVariable *iface)
4926 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4929 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShader(
4930 ID3D10EffectShaderResourceVariable *iface)
4932 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4935 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsBlend(
4936 ID3D10EffectShaderResourceVariable *iface)
4938 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4941 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencil(
4942 ID3D10EffectShaderResourceVariable *iface)
4944 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4947 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRasterizer(
4948 ID3D10EffectShaderResourceVariable *iface)
4950 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4953 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsSampler(
4954 ID3D10EffectShaderResourceVariable *iface)
4956 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4959 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetRawValue(
4960 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
4962 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4965 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetRawValue(
4966 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
4968 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4971 /* ID3D10EffectShaderResourceVariable methods */
4973 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResource(
4974 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView *resource)
4976 FIXME("iface %p, resource %p stub!\n", iface, resource);
4978 return E_NOTIMPL;
4981 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResource(
4982 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resource)
4984 FIXME("iface %p, resource %p stub!\n", iface, resource);
4986 return E_NOTIMPL;
4989 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResourceArray(
4990 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
4992 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
4994 return E_NOTIMPL;
4997 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResourceArray(
4998 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5000 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5002 return E_NOTIMPL;
5006 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl =
5008 /* ID3D10EffectVariable methods */
5009 d3d10_effect_shader_resource_variable_IsValid,
5010 d3d10_effect_shader_resource_variable_GetType,
5011 d3d10_effect_shader_resource_variable_GetDesc,
5012 d3d10_effect_shader_resource_variable_GetAnnotationByIndex,
5013 d3d10_effect_shader_resource_variable_GetAnnotationByName,
5014 d3d10_effect_shader_resource_variable_GetMemberByIndex,
5015 d3d10_effect_shader_resource_variable_GetMemberByName,
5016 d3d10_effect_shader_resource_variable_GetMemberBySemantic,
5017 d3d10_effect_shader_resource_variable_GetElement,
5018 d3d10_effect_shader_resource_variable_GetParentConstantBuffer,
5019 d3d10_effect_shader_resource_variable_AsScalar,
5020 d3d10_effect_shader_resource_variable_AsVector,
5021 d3d10_effect_shader_resource_variable_AsMatrix,
5022 d3d10_effect_shader_resource_variable_AsString,
5023 d3d10_effect_shader_resource_variable_AsShaderResource,
5024 d3d10_effect_shader_resource_variable_AsRenderTargetView,
5025 d3d10_effect_shader_resource_variable_AsDepthStencilView,
5026 d3d10_effect_shader_resource_variable_AsConstantBuffer,
5027 d3d10_effect_shader_resource_variable_AsShader,
5028 d3d10_effect_shader_resource_variable_AsBlend,
5029 d3d10_effect_shader_resource_variable_AsDepthStencil,
5030 d3d10_effect_shader_resource_variable_AsRasterizer,
5031 d3d10_effect_shader_resource_variable_AsSampler,
5032 d3d10_effect_shader_resource_variable_SetRawValue,
5033 d3d10_effect_shader_resource_variable_GetRawValue,
5034 /* ID3D10EffectShaderResourceVariable methods */
5035 d3d10_effect_shader_resource_variable_SetResource,
5036 d3d10_effect_shader_resource_variable_GetResource,
5037 d3d10_effect_shader_resource_variable_SetResourceArray,
5038 d3d10_effect_shader_resource_variable_GetResourceArray,
5041 /* ID3D10EffectVariable methods */
5043 static BOOL STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_IsValid(
5044 ID3D10EffectRenderTargetViewVariable *iface)
5046 TRACE("iface %p\n", iface);
5048 return (struct d3d10_effect_variable *)iface != &null_render_target_view_variable;
5051 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetType(
5052 ID3D10EffectRenderTargetViewVariable *iface)
5054 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5057 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetDesc(
5058 ID3D10EffectRenderTargetViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5060 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5063 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByIndex(
5064 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5066 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5069 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByName(
5070 ID3D10EffectRenderTargetViewVariable *iface, LPCSTR name)
5072 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5075 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByIndex(
5076 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5078 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5081 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByName(
5082 ID3D10EffectRenderTargetViewVariable *iface, LPCSTR name)
5084 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5087 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberBySemantic(
5088 ID3D10EffectRenderTargetViewVariable *iface, LPCSTR semantic)
5090 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5093 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetElement(
5094 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5096 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5099 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetParentConstantBuffer(
5100 ID3D10EffectRenderTargetViewVariable *iface)
5102 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5105 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsScalar(
5106 ID3D10EffectRenderTargetViewVariable *iface)
5108 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5111 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsVector(
5112 ID3D10EffectRenderTargetViewVariable *iface)
5114 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5117 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsMatrix(
5118 ID3D10EffectRenderTargetViewVariable *iface)
5120 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5123 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsString(
5124 ID3D10EffectRenderTargetViewVariable *iface)
5126 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5129 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShaderResource(
5130 ID3D10EffectRenderTargetViewVariable *iface)
5132 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5135 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRenderTargetView(
5136 ID3D10EffectRenderTargetViewVariable *iface)
5138 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5141 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencilView(
5142 ID3D10EffectRenderTargetViewVariable *iface)
5144 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5147 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsConstantBuffer(
5148 ID3D10EffectRenderTargetViewVariable *iface)
5150 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5153 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShader(
5154 ID3D10EffectRenderTargetViewVariable *iface)
5156 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5159 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsBlend(
5160 ID3D10EffectRenderTargetViewVariable *iface)
5162 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5165 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencil(
5166 ID3D10EffectRenderTargetViewVariable *iface)
5168 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5171 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRasterizer(
5172 ID3D10EffectRenderTargetViewVariable *iface)
5174 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5177 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsSampler(
5178 ID3D10EffectRenderTargetViewVariable *iface)
5180 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5183 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRawValue(
5184 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5186 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5189 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRawValue(
5190 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5192 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5195 /* ID3D10EffectRenderTargetViewVariable methods */
5197 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTarget(
5198 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView *view)
5200 FIXME("iface %p, view %p stub!\n", iface, view);
5202 return E_NOTIMPL;
5205 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTarget(
5206 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **view)
5208 FIXME("iface %p, view %p stub!\n", iface, view);
5210 return E_NOTIMPL;
5213 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTargetArray(
5214 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5216 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5218 return E_NOTIMPL;
5221 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTargetArray(
5222 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5224 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5226 return E_NOTIMPL;
5230 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl =
5232 /* ID3D10EffectVariable methods */
5233 d3d10_effect_render_target_view_variable_IsValid,
5234 d3d10_effect_render_target_view_variable_GetType,
5235 d3d10_effect_render_target_view_variable_GetDesc,
5236 d3d10_effect_render_target_view_variable_GetAnnotationByIndex,
5237 d3d10_effect_render_target_view_variable_GetAnnotationByName,
5238 d3d10_effect_render_target_view_variable_GetMemberByIndex,
5239 d3d10_effect_render_target_view_variable_GetMemberByName,
5240 d3d10_effect_render_target_view_variable_GetMemberBySemantic,
5241 d3d10_effect_render_target_view_variable_GetElement,
5242 d3d10_effect_render_target_view_variable_GetParentConstantBuffer,
5243 d3d10_effect_render_target_view_variable_AsScalar,
5244 d3d10_effect_render_target_view_variable_AsVector,
5245 d3d10_effect_render_target_view_variable_AsMatrix,
5246 d3d10_effect_render_target_view_variable_AsString,
5247 d3d10_effect_render_target_view_variable_AsShaderResource,
5248 d3d10_effect_render_target_view_variable_AsRenderTargetView,
5249 d3d10_effect_render_target_view_variable_AsDepthStencilView,
5250 d3d10_effect_render_target_view_variable_AsConstantBuffer,
5251 d3d10_effect_render_target_view_variable_AsShader,
5252 d3d10_effect_render_target_view_variable_AsBlend,
5253 d3d10_effect_render_target_view_variable_AsDepthStencil,
5254 d3d10_effect_render_target_view_variable_AsRasterizer,
5255 d3d10_effect_render_target_view_variable_AsSampler,
5256 d3d10_effect_render_target_view_variable_SetRawValue,
5257 d3d10_effect_render_target_view_variable_GetRawValue,
5258 /* ID3D10EffectRenderTargetViewVariable methods */
5259 d3d10_effect_render_target_view_variable_SetRenderTarget,
5260 d3d10_effect_render_target_view_variable_GetRenderTarget,
5261 d3d10_effect_render_target_view_variable_SetRenderTargetArray,
5262 d3d10_effect_render_target_view_variable_GetRenderTargetArray,
5265 /* ID3D10EffectVariable methods */
5267 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_IsValid(
5268 ID3D10EffectDepthStencilViewVariable *iface)
5270 TRACE("iface %p\n", iface);
5272 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_view_variable;
5275 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetType(
5276 ID3D10EffectDepthStencilViewVariable *iface)
5278 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5281 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDesc(
5282 ID3D10EffectDepthStencilViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5284 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5287 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex(
5288 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5290 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5293 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByName(
5294 ID3D10EffectDepthStencilViewVariable *iface, LPCSTR name)
5296 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5299 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByIndex(
5300 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5302 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5305 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByName(
5306 ID3D10EffectDepthStencilViewVariable *iface, LPCSTR name)
5308 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5311 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic(
5312 ID3D10EffectDepthStencilViewVariable *iface, LPCSTR semantic)
5314 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5317 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetElement(
5318 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5320 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5323 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer(
5324 ID3D10EffectDepthStencilViewVariable *iface)
5326 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5329 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsScalar(
5330 ID3D10EffectDepthStencilViewVariable *iface)
5332 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5335 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsVector(
5336 ID3D10EffectDepthStencilViewVariable *iface)
5338 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5341 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsMatrix(
5342 ID3D10EffectDepthStencilViewVariable *iface)
5344 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5347 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsString(
5348 ID3D10EffectDepthStencilViewVariable *iface)
5350 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5353 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShaderResource(
5354 ID3D10EffectDepthStencilViewVariable *iface)
5356 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5359 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRenderTargetView(
5360 ID3D10EffectDepthStencilViewVariable *iface)
5362 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5365 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencilView(
5366 ID3D10EffectDepthStencilViewVariable *iface)
5368 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5371 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsConstantBuffer(
5372 ID3D10EffectDepthStencilViewVariable *iface)
5374 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5377 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShader(
5378 ID3D10EffectDepthStencilViewVariable *iface)
5380 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5383 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsBlend(
5384 ID3D10EffectDepthStencilViewVariable *iface)
5386 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5389 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencil(
5390 ID3D10EffectDepthStencilViewVariable *iface)
5392 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5395 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRasterizer(
5396 ID3D10EffectDepthStencilViewVariable *iface)
5398 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5401 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsSampler(
5402 ID3D10EffectDepthStencilViewVariable *iface)
5404 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5407 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetRawValue(
5408 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5410 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5413 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetRawValue(
5414 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5416 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5419 /* ID3D10EffectDepthStencilViewVariable methods */
5421 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencil(
5422 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView *view)
5424 FIXME("iface %p, view %p stub!\n", iface, view);
5426 return E_NOTIMPL;
5429 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencil(
5430 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **view)
5432 FIXME("iface %p, view %p stub!\n", iface, view);
5434 return E_NOTIMPL;
5437 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray(
5438 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5440 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5442 return E_NOTIMPL;
5445 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray(
5446 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5448 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5450 return E_NOTIMPL;
5454 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl =
5456 /* ID3D10EffectVariable methods */
5457 d3d10_effect_depth_stencil_view_variable_IsValid,
5458 d3d10_effect_depth_stencil_view_variable_GetType,
5459 d3d10_effect_depth_stencil_view_variable_GetDesc,
5460 d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex,
5461 d3d10_effect_depth_stencil_view_variable_GetAnnotationByName,
5462 d3d10_effect_depth_stencil_view_variable_GetMemberByIndex,
5463 d3d10_effect_depth_stencil_view_variable_GetMemberByName,
5464 d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic,
5465 d3d10_effect_depth_stencil_view_variable_GetElement,
5466 d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer,
5467 d3d10_effect_depth_stencil_view_variable_AsScalar,
5468 d3d10_effect_depth_stencil_view_variable_AsVector,
5469 d3d10_effect_depth_stencil_view_variable_AsMatrix,
5470 d3d10_effect_depth_stencil_view_variable_AsString,
5471 d3d10_effect_depth_stencil_view_variable_AsShaderResource,
5472 d3d10_effect_depth_stencil_view_variable_AsRenderTargetView,
5473 d3d10_effect_depth_stencil_view_variable_AsDepthStencilView,
5474 d3d10_effect_depth_stencil_view_variable_AsConstantBuffer,
5475 d3d10_effect_depth_stencil_view_variable_AsShader,
5476 d3d10_effect_depth_stencil_view_variable_AsBlend,
5477 d3d10_effect_depth_stencil_view_variable_AsDepthStencil,
5478 d3d10_effect_depth_stencil_view_variable_AsRasterizer,
5479 d3d10_effect_depth_stencil_view_variable_AsSampler,
5480 d3d10_effect_depth_stencil_view_variable_SetRawValue,
5481 d3d10_effect_depth_stencil_view_variable_GetRawValue,
5482 /* ID3D10EffectDepthStencilViewVariable methods */
5483 d3d10_effect_depth_stencil_view_variable_SetDepthStencil,
5484 d3d10_effect_depth_stencil_view_variable_GetDepthStencil,
5485 d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray,
5486 d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray,
5489 /* ID3D10EffectVariable methods */
5491 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_variable_IsValid(ID3D10EffectShaderVariable *iface)
5493 TRACE("iface %p\n", iface);
5495 return (struct d3d10_effect_variable *)iface != &null_shader_variable;
5498 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetType(
5499 ID3D10EffectShaderVariable *iface)
5501 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5504 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetDesc(ID3D10EffectShaderVariable *iface,
5505 D3D10_EFFECT_VARIABLE_DESC *desc)
5507 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5510 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByIndex(
5511 ID3D10EffectShaderVariable *iface, UINT index)
5513 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5516 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByName(
5517 ID3D10EffectShaderVariable *iface, LPCSTR name)
5519 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5522 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByIndex(
5523 ID3D10EffectShaderVariable *iface, UINT index)
5525 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5528 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByName(
5529 ID3D10EffectShaderVariable *iface, LPCSTR name)
5531 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5534 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberBySemantic(
5535 ID3D10EffectShaderVariable *iface, LPCSTR semantic)
5537 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5540 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetElement(
5541 ID3D10EffectShaderVariable *iface, UINT index)
5543 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5546 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetParentConstantBuffer(
5547 ID3D10EffectShaderVariable *iface)
5549 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5552 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsScalar(
5553 ID3D10EffectShaderVariable *iface)
5555 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5558 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsVector(
5559 ID3D10EffectShaderVariable *iface)
5561 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5564 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsMatrix(
5565 ID3D10EffectShaderVariable *iface)
5567 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5570 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsString(
5571 ID3D10EffectShaderVariable *iface)
5573 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5576 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShaderResource(
5577 ID3D10EffectShaderVariable *iface)
5579 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5582 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRenderTargetView(
5583 ID3D10EffectShaderVariable *iface)
5585 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5588 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencilView(
5589 ID3D10EffectShaderVariable *iface)
5591 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5594 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsConstantBuffer(
5595 ID3D10EffectShaderVariable *iface)
5597 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5600 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShader(
5601 ID3D10EffectShaderVariable *iface)
5603 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5606 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsBlend(
5607 ID3D10EffectShaderVariable *iface)
5609 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5612 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencil(
5613 ID3D10EffectShaderVariable *iface)
5615 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5618 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRasterizer(
5619 ID3D10EffectShaderVariable *iface)
5621 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5624 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsSampler(
5625 ID3D10EffectShaderVariable *iface)
5627 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5630 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_SetRawValue(
5631 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5633 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5636 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetRawValue(
5637 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5639 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5642 /* ID3D10EffectShaderVariable methods */
5644 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetShaderDesc(
5645 ID3D10EffectShaderVariable *iface, UINT index, D3D10_EFFECT_SHADER_DESC *desc)
5647 FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc);
5649 return E_NOTIMPL;
5652 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetVertexShader(
5653 ID3D10EffectShaderVariable *iface, UINT index, ID3D10VertexShader **shader)
5655 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5657 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5659 if (v->type->element_count)
5660 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5662 if (v->type->basetype != D3D10_SVT_VERTEXSHADER)
5664 WARN("Shader is not a vertex shader.\n");
5665 return E_FAIL;
5668 if ((*shader = v->u.shader.shader.vs))
5669 ID3D10VertexShader_AddRef(*shader);
5671 return S_OK;
5674 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetGeometryShader(
5675 ID3D10EffectShaderVariable *iface, UINT index, ID3D10GeometryShader **shader)
5677 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5679 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5681 if (v->type->element_count)
5682 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5684 if (v->type->basetype != D3D10_SVT_GEOMETRYSHADER)
5686 WARN("Shader is not a geometry shader.\n");
5687 return E_FAIL;
5690 if ((*shader = v->u.shader.shader.gs))
5691 ID3D10GeometryShader_AddRef(*shader);
5693 return S_OK;
5696 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetPixelShader(
5697 ID3D10EffectShaderVariable *iface, UINT index, ID3D10PixelShader **shader)
5699 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5701 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5703 if (v->type->element_count)
5704 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5706 if (v->type->basetype != D3D10_SVT_PIXELSHADER)
5708 WARN("Shader is not a pixel shader.\n");
5709 return E_FAIL;
5712 if ((*shader = v->u.shader.shader.ps))
5713 ID3D10PixelShader_AddRef(*shader);
5715 return S_OK;
5718 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetInputSignatureElementDesc(
5719 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5720 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5722 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5723 struct d3d10_effect_shader_variable *s;
5724 D3D10_SIGNATURE_PARAMETER_DESC *d;
5726 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5727 iface, shader_index, element_index, desc);
5729 if (!iface->lpVtbl->IsValid(iface))
5731 WARN("Null variable specified\n");
5732 return E_FAIL;
5735 /* Check shader_index, this crashes on W7/DX10 */
5736 if (shader_index >= This->effect->used_shader_count)
5738 WARN("This should crash on W7/DX10!\n");
5739 return E_FAIL;
5742 s = &This->effect->used_shaders[shader_index]->u.shader;
5743 if (!s->input_signature.signature)
5745 WARN("No shader signature\n");
5746 return D3DERR_INVALIDCALL;
5749 /* Check desc for NULL, this crashes on W7/DX10 */
5750 if (!desc)
5752 WARN("This should crash on W7/DX10!\n");
5753 return E_FAIL;
5756 if (element_index >= s->input_signature.element_count)
5758 WARN("Invalid element index specified\n");
5759 return E_INVALIDARG;
5762 d = &s->input_signature.elements[element_index];
5763 desc->SemanticName = d->SemanticName;
5764 desc->SemanticIndex = d->SemanticIndex;
5765 desc->SystemValueType = d->SystemValueType;
5766 desc->ComponentType = d->ComponentType;
5767 desc->Register = d->Register;
5768 desc->ReadWriteMask = d->ReadWriteMask;
5769 desc->Mask = d->Mask;
5771 return S_OK;
5774 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetOutputSignatureElementDesc(
5775 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5776 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5778 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5779 struct d3d10_effect_shader_variable *s;
5780 D3D10_SIGNATURE_PARAMETER_DESC *d;
5782 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5783 iface, shader_index, element_index, desc);
5785 if (!iface->lpVtbl->IsValid(iface))
5787 WARN("Null variable specified\n");
5788 return E_FAIL;
5791 /* Check shader_index, this crashes on W7/DX10 */
5792 if (shader_index >= This->effect->used_shader_count)
5794 WARN("This should crash on W7/DX10!\n");
5795 return E_FAIL;
5798 s = &This->effect->used_shaders[shader_index]->u.shader;
5799 if (!s->output_signature.signature)
5801 WARN("No shader signature\n");
5802 return D3DERR_INVALIDCALL;
5805 /* Check desc for NULL, this crashes on W7/DX10 */
5806 if (!desc)
5808 WARN("This should crash on W7/DX10!\n");
5809 return E_FAIL;
5812 if (element_index >= s->output_signature.element_count)
5814 WARN("Invalid element index specified\n");
5815 return E_INVALIDARG;
5818 d = &s->output_signature.elements[element_index];
5819 desc->SemanticName = d->SemanticName;
5820 desc->SemanticIndex = d->SemanticIndex;
5821 desc->SystemValueType = d->SystemValueType;
5822 desc->ComponentType = d->ComponentType;
5823 desc->Register = d->Register;
5824 desc->ReadWriteMask = d->ReadWriteMask;
5825 desc->Mask = d->Mask;
5827 return S_OK;
5831 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl =
5833 /* ID3D10EffectVariable methods */
5834 d3d10_effect_shader_variable_IsValid,
5835 d3d10_effect_shader_variable_GetType,
5836 d3d10_effect_shader_variable_GetDesc,
5837 d3d10_effect_shader_variable_GetAnnotationByIndex,
5838 d3d10_effect_shader_variable_GetAnnotationByName,
5839 d3d10_effect_shader_variable_GetMemberByIndex,
5840 d3d10_effect_shader_variable_GetMemberByName,
5841 d3d10_effect_shader_variable_GetMemberBySemantic,
5842 d3d10_effect_shader_variable_GetElement,
5843 d3d10_effect_shader_variable_GetParentConstantBuffer,
5844 d3d10_effect_shader_variable_AsScalar,
5845 d3d10_effect_shader_variable_AsVector,
5846 d3d10_effect_shader_variable_AsMatrix,
5847 d3d10_effect_shader_variable_AsString,
5848 d3d10_effect_shader_variable_AsShaderResource,
5849 d3d10_effect_shader_variable_AsRenderTargetView,
5850 d3d10_effect_shader_variable_AsDepthStencilView,
5851 d3d10_effect_shader_variable_AsConstantBuffer,
5852 d3d10_effect_shader_variable_AsShader,
5853 d3d10_effect_shader_variable_AsBlend,
5854 d3d10_effect_shader_variable_AsDepthStencil,
5855 d3d10_effect_shader_variable_AsRasterizer,
5856 d3d10_effect_shader_variable_AsSampler,
5857 d3d10_effect_shader_variable_SetRawValue,
5858 d3d10_effect_shader_variable_GetRawValue,
5859 /* ID3D10EffectShaderVariable methods */
5860 d3d10_effect_shader_variable_GetShaderDesc,
5861 d3d10_effect_shader_variable_GetVertexShader,
5862 d3d10_effect_shader_variable_GetGeometryShader,
5863 d3d10_effect_shader_variable_GetPixelShader,
5864 d3d10_effect_shader_variable_GetInputSignatureElementDesc,
5865 d3d10_effect_shader_variable_GetOutputSignatureElementDesc,
5868 /* ID3D10EffectVariable methods */
5870 static BOOL STDMETHODCALLTYPE d3d10_effect_blend_variable_IsValid(ID3D10EffectBlendVariable *iface)
5872 TRACE("iface %p\n", iface);
5874 return (struct d3d10_effect_variable *)iface != &null_blend_variable;
5877 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetType(
5878 ID3D10EffectBlendVariable *iface)
5880 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5883 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetDesc(ID3D10EffectBlendVariable *iface,
5884 D3D10_EFFECT_VARIABLE_DESC *desc)
5886 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5889 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByIndex(
5890 ID3D10EffectBlendVariable *iface, UINT index)
5892 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5895 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByName(
5896 ID3D10EffectBlendVariable *iface, LPCSTR name)
5898 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5901 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByIndex(
5902 ID3D10EffectBlendVariable *iface, UINT index)
5904 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5907 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByName(
5908 ID3D10EffectBlendVariable *iface, LPCSTR name)
5910 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5913 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberBySemantic(
5914 ID3D10EffectBlendVariable *iface, LPCSTR semantic)
5916 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5919 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetElement(
5920 ID3D10EffectBlendVariable *iface, UINT index)
5922 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5925 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetParentConstantBuffer(
5926 ID3D10EffectBlendVariable *iface)
5928 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5931 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsScalar(
5932 ID3D10EffectBlendVariable *iface)
5934 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5937 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsVector(
5938 ID3D10EffectBlendVariable *iface)
5940 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5943 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsMatrix(
5944 ID3D10EffectBlendVariable *iface)
5946 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5949 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsString(
5950 ID3D10EffectBlendVariable *iface)
5952 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5955 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShaderResource(
5956 ID3D10EffectBlendVariable *iface)
5958 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5961 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRenderTargetView(
5962 ID3D10EffectBlendVariable *iface)
5964 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5967 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencilView(
5968 ID3D10EffectBlendVariable *iface)
5970 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5973 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsConstantBuffer(
5974 ID3D10EffectBlendVariable *iface)
5976 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5979 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShader(
5980 ID3D10EffectBlendVariable *iface)
5982 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5985 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsBlend(
5986 ID3D10EffectBlendVariable *iface)
5988 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5991 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencil(
5992 ID3D10EffectBlendVariable *iface)
5994 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5997 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRasterizer(
5998 ID3D10EffectBlendVariable *iface)
6000 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6003 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsSampler(
6004 ID3D10EffectBlendVariable *iface)
6006 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6009 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_SetRawValue(ID3D10EffectBlendVariable *iface,
6010 void *data, UINT offset, UINT count)
6012 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6015 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetRawValue(ID3D10EffectBlendVariable *iface,
6016 void *data, UINT offset, UINT count)
6018 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6021 /* ID3D10EffectBlendVariable methods */
6023 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBlendState(ID3D10EffectBlendVariable *iface,
6024 UINT index, ID3D10BlendState **blend_state)
6026 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6028 TRACE("iface %p, index %u, blend_state %p.\n", iface, index, blend_state);
6030 if (v->type->element_count)
6031 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6032 else if (index)
6033 return E_FAIL;
6035 if (v->type->basetype != D3D10_SVT_BLEND)
6037 WARN("Variable is not a blend state.\n");
6038 return E_FAIL;
6041 if ((*blend_state = v->u.state.object.blend))
6042 ID3D10BlendState_AddRef(*blend_state);
6044 return S_OK;
6047 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBackingStore(ID3D10EffectBlendVariable *iface,
6048 UINT index, D3D10_BLEND_DESC *desc)
6050 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6052 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6054 if (v->type->element_count)
6055 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6057 if (v->type->basetype != D3D10_SVT_BLEND)
6059 WARN("Variable is not a blend state.\n");
6060 return E_FAIL;
6063 *desc = v->u.state.desc.blend;
6065 return S_OK;
6069 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl =
6071 /* ID3D10EffectVariable methods */
6072 d3d10_effect_blend_variable_IsValid,
6073 d3d10_effect_blend_variable_GetType,
6074 d3d10_effect_blend_variable_GetDesc,
6075 d3d10_effect_blend_variable_GetAnnotationByIndex,
6076 d3d10_effect_blend_variable_GetAnnotationByName,
6077 d3d10_effect_blend_variable_GetMemberByIndex,
6078 d3d10_effect_blend_variable_GetMemberByName,
6079 d3d10_effect_blend_variable_GetMemberBySemantic,
6080 d3d10_effect_blend_variable_GetElement,
6081 d3d10_effect_blend_variable_GetParentConstantBuffer,
6082 d3d10_effect_blend_variable_AsScalar,
6083 d3d10_effect_blend_variable_AsVector,
6084 d3d10_effect_blend_variable_AsMatrix,
6085 d3d10_effect_blend_variable_AsString,
6086 d3d10_effect_blend_variable_AsShaderResource,
6087 d3d10_effect_blend_variable_AsRenderTargetView,
6088 d3d10_effect_blend_variable_AsDepthStencilView,
6089 d3d10_effect_blend_variable_AsConstantBuffer,
6090 d3d10_effect_blend_variable_AsShader,
6091 d3d10_effect_blend_variable_AsBlend,
6092 d3d10_effect_blend_variable_AsDepthStencil,
6093 d3d10_effect_blend_variable_AsRasterizer,
6094 d3d10_effect_blend_variable_AsSampler,
6095 d3d10_effect_blend_variable_SetRawValue,
6096 d3d10_effect_blend_variable_GetRawValue,
6097 /* ID3D10EffectBlendVariable methods */
6098 d3d10_effect_blend_variable_GetBlendState,
6099 d3d10_effect_blend_variable_GetBackingStore,
6102 /* ID3D10EffectVariable methods */
6104 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_IsValid(ID3D10EffectDepthStencilVariable *iface)
6106 TRACE("iface %p\n", iface);
6108 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_variable;
6111 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetType(
6112 ID3D10EffectDepthStencilVariable *iface)
6114 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6117 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDesc(ID3D10EffectDepthStencilVariable *iface,
6118 D3D10_EFFECT_VARIABLE_DESC *desc)
6120 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6123 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByIndex(
6124 ID3D10EffectDepthStencilVariable *iface, UINT index)
6126 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6129 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByName(
6130 ID3D10EffectDepthStencilVariable *iface, LPCSTR name)
6132 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6135 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByIndex(
6136 ID3D10EffectDepthStencilVariable *iface, UINT index)
6138 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6141 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByName(
6142 ID3D10EffectDepthStencilVariable *iface, LPCSTR name)
6144 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6147 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberBySemantic(
6148 ID3D10EffectDepthStencilVariable *iface, LPCSTR semantic)
6150 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6153 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetElement(
6154 ID3D10EffectDepthStencilVariable *iface, UINT index)
6156 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6159 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetParentConstantBuffer(
6160 ID3D10EffectDepthStencilVariable *iface)
6162 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6165 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsScalar(
6166 ID3D10EffectDepthStencilVariable *iface)
6168 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6171 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsVector(
6172 ID3D10EffectDepthStencilVariable *iface)
6174 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6177 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsMatrix(
6178 ID3D10EffectDepthStencilVariable *iface)
6180 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6183 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsString(
6184 ID3D10EffectDepthStencilVariable *iface)
6186 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6189 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShaderResource(
6190 ID3D10EffectDepthStencilVariable *iface)
6192 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6195 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRenderTargetView(
6196 ID3D10EffectDepthStencilVariable *iface)
6198 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6201 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencilView(
6202 ID3D10EffectDepthStencilVariable *iface)
6204 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6207 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsConstantBuffer(
6208 ID3D10EffectDepthStencilVariable *iface)
6210 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6213 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShader(
6214 ID3D10EffectDepthStencilVariable *iface)
6216 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6219 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsBlend(
6220 ID3D10EffectDepthStencilVariable *iface)
6222 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6225 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencil(
6226 ID3D10EffectDepthStencilVariable *iface)
6228 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6231 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRasterizer(
6232 ID3D10EffectDepthStencilVariable *iface)
6234 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6237 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsSampler(
6238 ID3D10EffectDepthStencilVariable *iface)
6240 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6243 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_SetRawValue(ID3D10EffectDepthStencilVariable *iface,
6244 void *data, UINT offset, UINT count)
6246 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6249 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetRawValue(ID3D10EffectDepthStencilVariable *iface,
6250 void *data, UINT offset, UINT count)
6252 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6255 /* ID3D10EffectDepthStencilVariable methods */
6257 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDepthStencilState(ID3D10EffectDepthStencilVariable *iface,
6258 UINT index, ID3D10DepthStencilState **depth_stencil_state)
6260 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6262 TRACE("iface %p, index %u, depth_stencil_state %p.\n", iface, index, depth_stencil_state);
6264 if (v->type->element_count)
6265 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6266 else if (index)
6267 return E_FAIL;
6269 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6271 WARN("Variable is not a depth stencil state.\n");
6272 return E_FAIL;
6275 if ((*depth_stencil_state = v->u.state.object.depth_stencil))
6276 ID3D10DepthStencilState_AddRef(*depth_stencil_state);
6278 return S_OK;
6281 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetBackingStore(ID3D10EffectDepthStencilVariable *iface,
6282 UINT index, D3D10_DEPTH_STENCIL_DESC *desc)
6284 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6286 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6288 if (v->type->element_count)
6289 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6291 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6293 WARN("Variable is not a depth stencil state.\n");
6294 return E_FAIL;
6297 *desc = v->u.state.desc.depth_stencil;
6299 return S_OK;
6303 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl =
6305 /* ID3D10EffectVariable methods */
6306 d3d10_effect_depth_stencil_variable_IsValid,
6307 d3d10_effect_depth_stencil_variable_GetType,
6308 d3d10_effect_depth_stencil_variable_GetDesc,
6309 d3d10_effect_depth_stencil_variable_GetAnnotationByIndex,
6310 d3d10_effect_depth_stencil_variable_GetAnnotationByName,
6311 d3d10_effect_depth_stencil_variable_GetMemberByIndex,
6312 d3d10_effect_depth_stencil_variable_GetMemberByName,
6313 d3d10_effect_depth_stencil_variable_GetMemberBySemantic,
6314 d3d10_effect_depth_stencil_variable_GetElement,
6315 d3d10_effect_depth_stencil_variable_GetParentConstantBuffer,
6316 d3d10_effect_depth_stencil_variable_AsScalar,
6317 d3d10_effect_depth_stencil_variable_AsVector,
6318 d3d10_effect_depth_stencil_variable_AsMatrix,
6319 d3d10_effect_depth_stencil_variable_AsString,
6320 d3d10_effect_depth_stencil_variable_AsShaderResource,
6321 d3d10_effect_depth_stencil_variable_AsRenderTargetView,
6322 d3d10_effect_depth_stencil_variable_AsDepthStencilView,
6323 d3d10_effect_depth_stencil_variable_AsConstantBuffer,
6324 d3d10_effect_depth_stencil_variable_AsShader,
6325 d3d10_effect_depth_stencil_variable_AsBlend,
6326 d3d10_effect_depth_stencil_variable_AsDepthStencil,
6327 d3d10_effect_depth_stencil_variable_AsRasterizer,
6328 d3d10_effect_depth_stencil_variable_AsSampler,
6329 d3d10_effect_depth_stencil_variable_SetRawValue,
6330 d3d10_effect_depth_stencil_variable_GetRawValue,
6331 /* ID3D10EffectDepthStencilVariable methods */
6332 d3d10_effect_depth_stencil_variable_GetDepthStencilState,
6333 d3d10_effect_depth_stencil_variable_GetBackingStore,
6336 /* ID3D10EffectVariable methods */
6338 static BOOL STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_IsValid(ID3D10EffectRasterizerVariable *iface)
6340 TRACE("iface %p\n", iface);
6342 return (struct d3d10_effect_variable *)iface != &null_rasterizer_variable;
6345 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetType(
6346 ID3D10EffectRasterizerVariable *iface)
6348 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6351 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetDesc(ID3D10EffectRasterizerVariable *iface,
6352 D3D10_EFFECT_VARIABLE_DESC *desc)
6354 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6357 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByIndex(
6358 ID3D10EffectRasterizerVariable *iface, UINT index)
6360 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6363 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByName(
6364 ID3D10EffectRasterizerVariable *iface, LPCSTR name)
6366 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6369 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByIndex(
6370 ID3D10EffectRasterizerVariable *iface, UINT index)
6372 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6375 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByName(
6376 ID3D10EffectRasterizerVariable *iface, LPCSTR name)
6378 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6381 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberBySemantic(
6382 ID3D10EffectRasterizerVariable *iface, LPCSTR semantic)
6384 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6387 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetElement(
6388 ID3D10EffectRasterizerVariable *iface, UINT index)
6390 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6393 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetParentConstantBuffer(
6394 ID3D10EffectRasterizerVariable *iface)
6396 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6399 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsScalar(
6400 ID3D10EffectRasterizerVariable *iface)
6402 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6405 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsVector(
6406 ID3D10EffectRasterizerVariable *iface)
6408 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6411 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsMatrix(
6412 ID3D10EffectRasterizerVariable *iface)
6414 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6417 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsString(
6418 ID3D10EffectRasterizerVariable *iface)
6420 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6423 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShaderResource(
6424 ID3D10EffectRasterizerVariable *iface)
6426 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6429 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRenderTargetView(
6430 ID3D10EffectRasterizerVariable *iface)
6432 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6435 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencilView(
6436 ID3D10EffectRasterizerVariable *iface)
6438 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6441 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsConstantBuffer(
6442 ID3D10EffectRasterizerVariable *iface)
6444 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6447 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShader(
6448 ID3D10EffectRasterizerVariable *iface)
6450 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6453 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsBlend(
6454 ID3D10EffectRasterizerVariable *iface)
6456 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6459 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencil(
6460 ID3D10EffectRasterizerVariable *iface)
6462 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6465 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRasterizer(
6466 ID3D10EffectRasterizerVariable *iface)
6468 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6471 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsSampler(
6472 ID3D10EffectRasterizerVariable *iface)
6474 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6477 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_SetRawValue(ID3D10EffectRasterizerVariable *iface,
6478 void *data, UINT offset, UINT count)
6480 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6483 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRawValue(ID3D10EffectRasterizerVariable *iface,
6484 void *data, UINT offset, UINT count)
6486 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6489 /* ID3D10EffectRasterizerVariable methods */
6491 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRasterizerState(ID3D10EffectRasterizerVariable *iface,
6492 UINT index, ID3D10RasterizerState **rasterizer_state)
6494 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6496 TRACE("iface %p, index %u, rasterizer_state %p.\n", iface, index, rasterizer_state);
6498 if (v->type->element_count)
6499 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6500 else if (index)
6501 return E_FAIL;
6503 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6505 WARN("Variable is not a rasterizer state.\n");
6506 return E_FAIL;
6509 if ((*rasterizer_state = v->u.state.object.rasterizer))
6510 ID3D10RasterizerState_AddRef(*rasterizer_state);
6512 return S_OK;
6515 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetBackingStore(ID3D10EffectRasterizerVariable *iface,
6516 UINT index, D3D10_RASTERIZER_DESC *desc)
6518 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6520 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6522 if (v->type->element_count)
6523 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6525 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6527 WARN("Variable is not a rasterizer state.\n");
6528 return E_FAIL;
6531 *desc = v->u.state.desc.rasterizer;
6533 return S_OK;
6537 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl =
6539 /* ID3D10EffectVariable methods */
6540 d3d10_effect_rasterizer_variable_IsValid,
6541 d3d10_effect_rasterizer_variable_GetType,
6542 d3d10_effect_rasterizer_variable_GetDesc,
6543 d3d10_effect_rasterizer_variable_GetAnnotationByIndex,
6544 d3d10_effect_rasterizer_variable_GetAnnotationByName,
6545 d3d10_effect_rasterizer_variable_GetMemberByIndex,
6546 d3d10_effect_rasterizer_variable_GetMemberByName,
6547 d3d10_effect_rasterizer_variable_GetMemberBySemantic,
6548 d3d10_effect_rasterizer_variable_GetElement,
6549 d3d10_effect_rasterizer_variable_GetParentConstantBuffer,
6550 d3d10_effect_rasterizer_variable_AsScalar,
6551 d3d10_effect_rasterizer_variable_AsVector,
6552 d3d10_effect_rasterizer_variable_AsMatrix,
6553 d3d10_effect_rasterizer_variable_AsString,
6554 d3d10_effect_rasterizer_variable_AsShaderResource,
6555 d3d10_effect_rasterizer_variable_AsRenderTargetView,
6556 d3d10_effect_rasterizer_variable_AsDepthStencilView,
6557 d3d10_effect_rasterizer_variable_AsConstantBuffer,
6558 d3d10_effect_rasterizer_variable_AsShader,
6559 d3d10_effect_rasterizer_variable_AsBlend,
6560 d3d10_effect_rasterizer_variable_AsDepthStencil,
6561 d3d10_effect_rasterizer_variable_AsRasterizer,
6562 d3d10_effect_rasterizer_variable_AsSampler,
6563 d3d10_effect_rasterizer_variable_SetRawValue,
6564 d3d10_effect_rasterizer_variable_GetRawValue,
6565 /* ID3D10EffectRasterizerVariable methods */
6566 d3d10_effect_rasterizer_variable_GetRasterizerState,
6567 d3d10_effect_rasterizer_variable_GetBackingStore,
6570 /* ID3D10EffectVariable methods */
6572 static BOOL STDMETHODCALLTYPE d3d10_effect_sampler_variable_IsValid(ID3D10EffectSamplerVariable *iface)
6574 TRACE("iface %p\n", iface);
6576 return (struct d3d10_effect_variable *)iface != &null_sampler_variable;
6579 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetType(
6580 ID3D10EffectSamplerVariable *iface)
6582 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6585 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetDesc(ID3D10EffectSamplerVariable *iface,
6586 D3D10_EFFECT_VARIABLE_DESC *desc)
6588 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6591 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByIndex(
6592 ID3D10EffectSamplerVariable *iface, UINT index)
6594 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6597 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByName(
6598 ID3D10EffectSamplerVariable *iface, LPCSTR name)
6600 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6603 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByIndex(
6604 ID3D10EffectSamplerVariable *iface, UINT index)
6606 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6609 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByName(
6610 ID3D10EffectSamplerVariable *iface, LPCSTR name)
6612 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6615 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberBySemantic(
6616 ID3D10EffectSamplerVariable *iface, LPCSTR semantic)
6618 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6621 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetElement(
6622 ID3D10EffectSamplerVariable *iface, UINT index)
6624 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6627 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetParentConstantBuffer(
6628 ID3D10EffectSamplerVariable *iface)
6630 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6633 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsScalar(
6634 ID3D10EffectSamplerVariable *iface)
6636 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6639 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsVector(
6640 ID3D10EffectSamplerVariable *iface)
6642 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6645 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsMatrix(
6646 ID3D10EffectSamplerVariable *iface)
6648 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6651 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsString(
6652 ID3D10EffectSamplerVariable *iface)
6654 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6657 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShaderResource(
6658 ID3D10EffectSamplerVariable *iface)
6660 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6663 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRenderTargetView(
6664 ID3D10EffectSamplerVariable *iface)
6666 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6669 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencilView(
6670 ID3D10EffectSamplerVariable *iface)
6672 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6675 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsConstantBuffer(
6676 ID3D10EffectSamplerVariable *iface)
6678 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6681 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShader(
6682 ID3D10EffectSamplerVariable *iface)
6684 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6687 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsBlend(
6688 ID3D10EffectSamplerVariable *iface)
6690 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6693 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencil(
6694 ID3D10EffectSamplerVariable *iface)
6696 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6699 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRasterizer(
6700 ID3D10EffectSamplerVariable *iface)
6702 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6705 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsSampler(
6706 ID3D10EffectSamplerVariable *iface)
6708 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6711 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_SetRawValue(ID3D10EffectSamplerVariable *iface,
6712 void *data, UINT offset, UINT count)
6714 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6717 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetRawValue(ID3D10EffectSamplerVariable *iface,
6718 void *data, UINT offset, UINT count)
6720 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6723 /* ID3D10EffectSamplerVariable methods */
6725 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetSampler(ID3D10EffectSamplerVariable *iface,
6726 UINT index, ID3D10SamplerState **sampler)
6728 FIXME("iface %p, index %u, sampler %p stub!\n", iface, index, sampler);
6730 return E_NOTIMPL;
6733 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetBackingStore(ID3D10EffectSamplerVariable *iface,
6734 UINT index, D3D10_SAMPLER_DESC *desc)
6736 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6738 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6740 if (v->type->element_count)
6741 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6743 if (v->type->basetype != D3D10_SVT_SAMPLER)
6745 WARN("Variable is not a sampler state.\n");
6746 return E_FAIL;
6749 *desc = v->u.state.desc.sampler;
6751 return S_OK;
6755 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl =
6757 /* ID3D10EffectVariable methods */
6758 d3d10_effect_sampler_variable_IsValid,
6759 d3d10_effect_sampler_variable_GetType,
6760 d3d10_effect_sampler_variable_GetDesc,
6761 d3d10_effect_sampler_variable_GetAnnotationByIndex,
6762 d3d10_effect_sampler_variable_GetAnnotationByName,
6763 d3d10_effect_sampler_variable_GetMemberByIndex,
6764 d3d10_effect_sampler_variable_GetMemberByName,
6765 d3d10_effect_sampler_variable_GetMemberBySemantic,
6766 d3d10_effect_sampler_variable_GetElement,
6767 d3d10_effect_sampler_variable_GetParentConstantBuffer,
6768 d3d10_effect_sampler_variable_AsScalar,
6769 d3d10_effect_sampler_variable_AsVector,
6770 d3d10_effect_sampler_variable_AsMatrix,
6771 d3d10_effect_sampler_variable_AsString,
6772 d3d10_effect_sampler_variable_AsShaderResource,
6773 d3d10_effect_sampler_variable_AsRenderTargetView,
6774 d3d10_effect_sampler_variable_AsDepthStencilView,
6775 d3d10_effect_sampler_variable_AsConstantBuffer,
6776 d3d10_effect_sampler_variable_AsShader,
6777 d3d10_effect_sampler_variable_AsBlend,
6778 d3d10_effect_sampler_variable_AsDepthStencil,
6779 d3d10_effect_sampler_variable_AsRasterizer,
6780 d3d10_effect_sampler_variable_AsSampler,
6781 d3d10_effect_sampler_variable_SetRawValue,
6782 d3d10_effect_sampler_variable_GetRawValue,
6783 /* ID3D10EffectSamplerVariable methods */
6784 d3d10_effect_sampler_variable_GetSampler,
6785 d3d10_effect_sampler_variable_GetBackingStore,
6788 /* ID3D10EffectType methods */
6790 static inline struct d3d10_effect_type *impl_from_ID3D10EffectType(ID3D10EffectType *iface)
6792 return CONTAINING_RECORD(iface, struct d3d10_effect_type, ID3D10EffectType_iface);
6795 static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
6797 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6799 TRACE("iface %p\n", iface);
6801 return This != &null_type;
6804 static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *iface, D3D10_EFFECT_TYPE_DESC *desc)
6806 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6808 TRACE("iface %p, desc %p\n", iface, desc);
6810 if (This == &null_type)
6812 WARN("Null type specified\n");
6813 return E_FAIL;
6816 if (!desc)
6818 WARN("Invalid argument specified\n");
6819 return E_INVALIDARG;
6822 desc->TypeName = This->name;
6823 desc->Class = This->type_class;
6824 desc->Type = This->basetype;
6825 desc->Elements = This->element_count;
6826 desc->Members = This->member_count;
6827 desc->Rows = This->row_count;
6828 desc->Columns = This->column_count;
6829 desc->PackedSize = This->size_packed;
6830 desc->UnpackedSize = This->size_unpacked;
6831 desc->Stride = This->stride;
6833 return S_OK;
6836 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByIndex(ID3D10EffectType *iface,
6837 UINT index)
6839 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6840 struct d3d10_effect_type *t;
6842 TRACE("iface %p, index %u\n", iface, index);
6844 if (index >= This->member_count)
6846 WARN("Invalid index specified\n");
6847 return &null_type.ID3D10EffectType_iface;
6850 t = (&This->members[index])->type;
6852 TRACE("Returning member %p, %s\n", t, debugstr_a(t->name));
6854 return &t->ID3D10EffectType_iface;
6857 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByName(ID3D10EffectType *iface,
6858 LPCSTR name)
6860 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6861 unsigned int i;
6863 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
6865 if (!name)
6867 WARN("Invalid name specified\n");
6868 return &null_type.ID3D10EffectType_iface;
6871 for (i = 0; i < This->member_count; ++i)
6873 struct d3d10_effect_type_member *typem = &This->members[i];
6875 if (typem->name)
6877 if (!strcmp(typem->name, name))
6879 TRACE("Returning type %p.\n", typem->type);
6880 return &typem->type->ID3D10EffectType_iface;
6885 WARN("Invalid name specified\n");
6887 return &null_type.ID3D10EffectType_iface;
6890 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeBySemantic(ID3D10EffectType *iface,
6891 LPCSTR semantic)
6893 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6894 unsigned int i;
6896 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
6898 if (!semantic)
6900 WARN("Invalid semantic specified\n");
6901 return &null_type.ID3D10EffectType_iface;
6904 for (i = 0; i < This->member_count; ++i)
6906 struct d3d10_effect_type_member *typem = &This->members[i];
6908 if (typem->semantic)
6910 if (!strcmp(typem->semantic, semantic))
6912 TRACE("Returning type %p.\n", typem->type);
6913 return &typem->type->ID3D10EffectType_iface;
6918 WARN("Invalid semantic specified\n");
6920 return &null_type.ID3D10EffectType_iface;
6923 static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberName(ID3D10EffectType *iface, UINT index)
6925 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6926 struct d3d10_effect_type_member *typem;
6928 TRACE("iface %p, index %u\n", iface, index);
6930 if (index >= This->member_count)
6932 WARN("Invalid index specified\n");
6933 return NULL;
6936 typem = &This->members[index];
6938 TRACE("Returning name %s\n", debugstr_a(typem->name));
6940 return typem->name;
6943 static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberSemantic(ID3D10EffectType *iface, UINT index)
6945 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6946 struct d3d10_effect_type_member *typem;
6948 TRACE("iface %p, index %u\n", iface, index);
6950 if (index >= This->member_count)
6952 WARN("Invalid index specified\n");
6953 return NULL;
6956 typem = &This->members[index];
6958 TRACE("Returning semantic %s\n", debugstr_a(typem->semantic));
6960 return typem->semantic;
6963 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl =
6965 /* ID3D10EffectType */
6966 d3d10_effect_type_IsValid,
6967 d3d10_effect_type_GetDesc,
6968 d3d10_effect_type_GetMemberTypeByIndex,
6969 d3d10_effect_type_GetMemberTypeByName,
6970 d3d10_effect_type_GetMemberTypeBySemantic,
6971 d3d10_effect_type_GetMemberName,
6972 d3d10_effect_type_GetMemberSemantic,