msvcp: Sync fpos usage and istream<>::tellg.
[wine/multimedia.git] / dlls / d3d10 / effect.c
blobc465c43ec96a6c173a8c343d25ee0c0dc3983dbd
1 /*
2 * Copyright 2009 Henri Verbeet for CodeWeavers
3 * Copyright 2009 Rico Schüller
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
22 #include "wine/port.h"
24 #include "d3d10_private.h"
26 #include <float.h>
28 WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
30 #define D3D10_FX10_TYPE_COLUMN_SHIFT 11
31 #define D3D10_FX10_TYPE_COLUMN_MASK (0x7 << D3D10_FX10_TYPE_COLUMN_SHIFT)
33 #define D3D10_FX10_TYPE_ROW_SHIFT 8
34 #define D3D10_FX10_TYPE_ROW_MASK (0x7 << D3D10_FX10_TYPE_ROW_SHIFT)
36 #define D3D10_FX10_TYPE_BASETYPE_SHIFT 3
37 #define D3D10_FX10_TYPE_BASETYPE_MASK (0x1f << D3D10_FX10_TYPE_BASETYPE_SHIFT)
39 #define D3D10_FX10_TYPE_CLASS_SHIFT 0
40 #define D3D10_FX10_TYPE_CLASS_MASK (0x7 << D3D10_FX10_TYPE_CLASS_SHIFT)
42 #define D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK 0x4000
44 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl;
45 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl;
46 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl;
47 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl;
48 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl;
49 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl;
50 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl;
51 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl;
52 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl;
53 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl;
54 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl;
55 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl;
56 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl;
57 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl;
58 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl;
59 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl;
60 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl;
62 /* null objects - needed for invalid calls */
63 static struct d3d10_effect_technique null_technique = {{&d3d10_effect_technique_vtbl}};
64 static struct d3d10_effect_pass null_pass = {{&d3d10_effect_pass_vtbl}};
65 static struct d3d10_effect_type null_type = {{&d3d10_effect_type_vtbl}};
66 static struct d3d10_effect_variable null_local_buffer = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl},
67 &null_local_buffer, &null_type};
68 static struct d3d10_effect_variable null_variable = {{&d3d10_effect_variable_vtbl},
69 &null_local_buffer, &null_type};
70 static struct d3d10_effect_variable null_scalar_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl},
71 &null_local_buffer, &null_type};
72 static struct d3d10_effect_variable null_vector_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl},
73 &null_local_buffer, &null_type};
74 static struct d3d10_effect_variable null_matrix_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl},
75 &null_local_buffer, &null_type};
76 static struct d3d10_effect_variable null_string_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl},
77 &null_local_buffer, &null_type};
78 static struct d3d10_effect_variable null_shader_resource_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl},
79 &null_local_buffer, &null_type};
80 static struct d3d10_effect_variable null_render_target_view_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl},
81 &null_local_buffer, &null_type};
82 static struct d3d10_effect_variable null_depth_stencil_view_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl},
83 &null_local_buffer, &null_type};
84 static struct d3d10_effect_variable null_shader_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
85 &null_local_buffer, &null_type};
86 static struct d3d10_effect_variable null_blend_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl},
87 &null_local_buffer, &null_type};
88 static struct d3d10_effect_variable null_depth_stencil_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl},
89 &null_local_buffer, &null_type};
90 static struct d3d10_effect_variable null_rasterizer_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl},
91 &null_local_buffer, &null_type};
92 static struct d3d10_effect_variable null_sampler_variable = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl},
93 &null_local_buffer, &null_type};
95 /* anonymous_shader_type and anonymous_shader */
96 static char anonymous_name[] = "$Anonymous";
97 static char anonymous_vertexshader_name[] = "vertexshader";
98 static char anonymous_pixelshader_name[] = "pixelshader";
99 static char anonymous_geometryshader_name[] = "geometryshader";
100 static struct d3d10_effect_type anonymous_vs_type = {{&d3d10_effect_type_vtbl},
101 anonymous_vertexshader_name, D3D10_SVT_VERTEXSHADER, D3D10_SVC_OBJECT};
102 static struct d3d10_effect_type anonymous_ps_type = {{&d3d10_effect_type_vtbl},
103 anonymous_pixelshader_name, D3D10_SVT_PIXELSHADER, D3D10_SVC_OBJECT};
104 static struct d3d10_effect_type anonymous_gs_type = {{&d3d10_effect_type_vtbl},
105 anonymous_geometryshader_name, D3D10_SVT_GEOMETRYSHADER, D3D10_SVC_OBJECT};
106 static struct d3d10_effect_variable anonymous_vs = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
107 &null_local_buffer, &anonymous_vs_type, anonymous_name};
108 static struct d3d10_effect_variable anonymous_ps = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
109 &null_local_buffer, &anonymous_ps_type, anonymous_name};
110 static struct d3d10_effect_variable anonymous_gs = {{(const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl},
111 &null_local_buffer, &anonymous_gs_type, anonymous_name};
113 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset);
115 static inline struct d3d10_effect_variable *impl_from_ID3D10EffectVariable(ID3D10EffectVariable *iface)
117 return CONTAINING_RECORD(iface, struct d3d10_effect_variable, ID3D10EffectVariable_iface);
120 struct d3d10_effect_state_property_info
122 UINT id;
123 const char *name;
124 D3D_SHADER_VARIABLE_TYPE type;
125 UINT size;
126 UINT count;
127 D3D_SHADER_VARIABLE_TYPE container_type;
128 LONG offset;
131 static const struct d3d10_effect_state_property_info property_info[] =
133 {0x0c, "RasterizerState.FillMode", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FillMode) },
134 {0x0d, "RasterizerState.CullMode", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, CullMode) },
135 {0x0e, "RasterizerState.FrontCounterClockwise", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FrontCounterClockwise) },
136 {0x0f, "RasterizerState.DepthBias", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBias) },
137 {0x10, "RasterizerState.DepthBiasClamp", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBiasClamp) },
138 {0x11, "RasterizerState.SlopeScaledDepthBias", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, SlopeScaledDepthBias) },
139 {0x12, "RasterizerState.DepthClipEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthClipEnable) },
140 {0x13, "RasterizerState.ScissorEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, ScissorEnable) },
141 {0x14, "RasterizerState.MultisampleEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, MultisampleEnable) },
142 {0x15, "RasterizerState.AntialiasedLineEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, AntialiasedLineEnable) },
143 {0x16, "DepthStencilState.DepthEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthEnable) },
144 {0x17, "DepthStencilState.DepthWriteMask", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthWriteMask) },
145 {0x18, "DepthStencilState.DepthFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthFunc) },
146 {0x19, "DepthStencilState.StencilEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilEnable) },
147 {0x1a, "DepthStencilState.StencilReadMask", D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilReadMask) },
148 {0x1b, "DepthStencilState.StencilWriteMask", D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilWriteMask) },
149 {0x1c, "DepthStencilState.FrontFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFailOp) },
150 {0x1d, "DepthStencilState.FrontFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilDepthFailOp)},
151 {0x1e, "DepthStencilState.FrontFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilPassOp) },
152 {0x1f, "DepthStencilState.FrontFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFunc) },
153 {0x20, "DepthStencilState.BackFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFailOp) },
154 {0x21, "DepthStencilState.BackFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilDepthFailOp) },
155 {0x22, "DepthStencilState.BackFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilPassOp) },
156 {0x23, "DepthStencilState.BackFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFunc) },
157 {0x24, "BlendState.AlphaToCoverageEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, AlphaToCoverageEnable) },
158 {0x25, "BlendState.BlendEnable", D3D10_SVT_BOOL, 1, 8, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendEnable) },
159 {0x26, "BlendState.SrcBlend", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlend) },
160 {0x27, "BlendState.DestBlend", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlend) },
161 {0x28, "BlendState.BlendOp", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOp) },
162 {0x29, "BlendState.SrcBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlendAlpha) },
163 {0x2a, "BlendState.DestBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlendAlpha) },
164 {0x2b, "BlendState.BlendOpAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOpAlpha) },
165 {0x2c, "BlendState.RenderTargetWriteMask", D3D10_SVT_UINT8, 1, 8, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, RenderTargetWriteMask) },
166 {0x2d, "SamplerState.Filter", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, Filter) },
167 {0x2e, "SamplerState.AddressU", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressU) },
168 {0x2f, "SamplerState.AddressV", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressV) },
169 {0x30, "SamplerState.AddressW", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressW) },
170 {0x31, "SamplerState.MipMapLODBias", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MipLODBias) },
171 {0x32, "SamplerState.MaxAnisotropy", D3D10_SVT_UINT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxAnisotropy) },
172 {0x33, "SamplerState.ComparisonFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, ComparisonFunc) },
173 {0x34, "SamplerState.BorderColor", D3D10_SVT_FLOAT, 4, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, BorderColor) },
174 {0x35, "SamplerState.MinLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MinLOD) },
175 {0x36, "SamplerState.MaxLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxLOD) },
178 static const D3D10_RASTERIZER_DESC default_rasterizer_desc =
180 D3D10_FILL_SOLID,
181 D3D10_CULL_BACK,
182 FALSE,
184 0.0f,
185 0.0f,
186 TRUE,
187 FALSE,
188 FALSE,
189 FALSE,
192 static const D3D10_DEPTH_STENCIL_DESC default_depth_stencil_desc =
194 TRUE,
195 D3D10_DEPTH_WRITE_MASK_ALL,
196 D3D10_COMPARISON_LESS,
197 FALSE,
198 D3D10_DEFAULT_STENCIL_READ_MASK,
199 D3D10_DEFAULT_STENCIL_WRITE_MASK,
200 {D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_COMPARISON_ALWAYS},
201 {D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_STENCIL_OP_KEEP, D3D10_COMPARISON_ALWAYS},
204 static const D3D10_BLEND_DESC default_blend_desc =
206 FALSE,
207 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
208 D3D10_BLEND_SRC_ALPHA,
209 D3D10_BLEND_INV_SRC_ALPHA,
210 D3D10_BLEND_OP_ADD,
211 D3D10_BLEND_SRC_ALPHA,
212 D3D10_BLEND_INV_SRC_ALPHA,
213 D3D10_BLEND_OP_ADD,
214 {0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf},
217 static const D3D10_SAMPLER_DESC default_sampler_desc =
219 D3D10_FILTER_MIN_MAG_MIP_POINT,
220 D3D10_TEXTURE_ADDRESS_WRAP,
221 D3D10_TEXTURE_ADDRESS_WRAP,
222 D3D10_TEXTURE_ADDRESS_WRAP,
223 0.0f,
225 D3D10_COMPARISON_NEVER,
226 {0.0f, 0.0f, 0.0f, 0.0f},
227 0.0f,
228 FLT_MAX,
231 struct d3d10_effect_state_storage_info
233 D3D_SHADER_VARIABLE_TYPE id;
234 SIZE_T size;
235 const void *default_state;
238 static const struct d3d10_effect_state_storage_info d3d10_effect_state_storage_info[] =
240 {D3D10_SVT_RASTERIZER, sizeof(default_rasterizer_desc), &default_rasterizer_desc },
241 {D3D10_SVT_DEPTHSTENCIL, sizeof(default_depth_stencil_desc), &default_depth_stencil_desc},
242 {D3D10_SVT_BLEND, sizeof(default_blend_desc), &default_blend_desc },
243 {D3D10_SVT_SAMPLER, sizeof(default_sampler_desc), &default_sampler_desc },
246 static BOOL copy_name(const char *ptr, char **name)
248 size_t name_len;
250 if (!ptr) return TRUE;
252 name_len = strlen(ptr) + 1;
253 if (name_len == 1)
255 return TRUE;
258 *name = HeapAlloc(GetProcessHeap(), 0, name_len);
259 if (!*name)
261 ERR("Failed to allocate name memory.\n");
262 return FALSE;
265 memcpy(*name, ptr, name_len);
267 return TRUE;
270 static HRESULT shader_parse_signature(const char *data, DWORD data_size, struct d3d10_effect_shader_signature *s)
272 D3D10_SIGNATURE_PARAMETER_DESC *e;
273 const char *ptr = data;
274 unsigned int i;
275 DWORD count;
277 read_dword(&ptr, &count);
278 TRACE("%u elements\n", count);
280 skip_dword_unknown("shader signature", &ptr, 1);
282 e = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*e));
283 if (!e)
285 ERR("Failed to allocate signature memory.\n");
286 return E_OUTOFMEMORY;
289 for (i = 0; i < count; ++i)
291 UINT name_offset;
292 UINT mask;
294 read_dword(&ptr, &name_offset);
295 e[i].SemanticName = data + name_offset;
296 read_dword(&ptr, &e[i].SemanticIndex);
297 read_dword(&ptr, &e[i].SystemValueType);
298 read_dword(&ptr, &e[i].ComponentType);
299 read_dword(&ptr, &e[i].Register);
300 read_dword(&ptr, &mask);
302 e[i].ReadWriteMask = mask >> 8;
303 e[i].Mask = mask & 0xff;
305 TRACE("semantic: %s, semantic idx: %u, sysval_semantic %#x, "
306 "type %u, register idx: %u, use_mask %#x, input_mask %#x\n",
307 debugstr_a(e[i].SemanticName), e[i].SemanticIndex, e[i].SystemValueType,
308 e[i].ComponentType, e[i].Register, e[i].Mask, e[i].ReadWriteMask);
311 s->elements = e;
312 s->element_count = count;
314 return S_OK;
317 static void shader_free_signature(struct d3d10_effect_shader_signature *s)
319 HeapFree(GetProcessHeap(), 0, s->signature);
320 HeapFree(GetProcessHeap(), 0, s->elements);
323 static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
325 struct d3d10_effect_shader_variable *s = ctx;
326 HRESULT hr;
328 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
330 TRACE("chunk size: %#x\n", data_size);
332 switch(tag)
334 case TAG_ISGN:
335 case TAG_OSGN:
337 /* 32 (DXBC header) + 1 * 4 (chunk index) + 2 * 4 (chunk header) + data_size (chunk data) */
338 UINT size = 44 + data_size;
339 struct d3d10_effect_shader_signature *sig;
340 char *ptr;
342 if (tag == TAG_ISGN) sig = &s->input_signature;
343 else sig = &s->output_signature;
345 sig->signature = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
346 if (!sig->signature)
348 ERR("Failed to allocate input signature data\n");
349 return E_OUTOFMEMORY;
351 sig->signature_size = size;
353 ptr = sig->signature;
355 write_dword(&ptr, TAG_DXBC);
357 /* signature(?) */
358 write_dword_unknown(&ptr, 0);
359 write_dword_unknown(&ptr, 0);
360 write_dword_unknown(&ptr, 0);
361 write_dword_unknown(&ptr, 0);
363 /* seems to be always 1 */
364 write_dword_unknown(&ptr, 1);
366 /* DXBC size */
367 write_dword(&ptr, size);
369 /* chunk count */
370 write_dword(&ptr, 1);
372 /* chunk index */
373 write_dword(&ptr, (ptr - sig->signature) + 4);
375 /* chunk */
376 write_dword(&ptr, tag);
377 write_dword(&ptr, data_size);
378 memcpy(ptr, data, data_size);
380 hr = shader_parse_signature(ptr, data_size, sig);
381 if (FAILED(hr))
383 ERR("Failed to parse shader, hr %#x\n", hr);
384 shader_free_signature(sig);
387 break;
390 default:
391 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
392 break;
395 return S_OK;
398 static HRESULT parse_shader(ID3D10EffectVariable *variable, const char *data)
400 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable(variable);
401 ID3D10Device *device = v->effect->device;
402 const char *ptr = data;
403 DWORD dxbc_size;
404 HRESULT hr;
406 if (v->effect->used_shader_current >= v->effect->used_shader_count)
408 WARN("Invalid shader? Used shader current(%u) >= used shader count(%u)\n", v->effect->used_shader_current, v->effect->used_shader_count);
409 return E_FAIL;
412 v->effect->used_shaders[v->effect->used_shader_current] = v;
413 ++v->effect->used_shader_current;
415 if (!ptr) return S_OK;
417 read_dword(&ptr, &dxbc_size);
418 TRACE("dxbc size: %#x\n", dxbc_size);
420 /* We got a shader VertexShader vs = NULL, so it is fine to skip this. */
421 if (!dxbc_size) return S_OK;
423 switch (v->type->basetype)
425 case D3D10_SVT_VERTEXSHADER:
426 hr = ID3D10Device_CreateVertexShader(device, ptr, dxbc_size, &v->u.shader.shader.vs);
427 if (FAILED(hr)) return hr;
428 break;
430 case D3D10_SVT_PIXELSHADER:
431 hr = ID3D10Device_CreatePixelShader(device, ptr, dxbc_size, &v->u.shader.shader.ps);
432 if (FAILED(hr)) return hr;
433 break;
435 case D3D10_SVT_GEOMETRYSHADER:
436 hr = ID3D10Device_CreateGeometryShader(device, ptr, dxbc_size, &v->u.shader.shader.gs);
437 if (FAILED(hr)) return hr;
438 break;
440 default:
441 ERR("This should not happen!\n");
442 return E_FAIL;
445 return parse_dxbc(ptr, dxbc_size, shader_chunk_handler, &v->u.shader);
448 static D3D10_SHADER_VARIABLE_CLASS d3d10_variable_class(DWORD c, BOOL is_column_major)
450 switch (c)
452 case 1: return D3D10_SVC_SCALAR;
453 case 2: return D3D10_SVC_VECTOR;
454 case 3: if (is_column_major) return D3D10_SVC_MATRIX_COLUMNS;
455 else return D3D10_SVC_MATRIX_ROWS;
456 default:
457 FIXME("Unknown variable class %#x.\n", c);
458 return 0;
462 static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object)
464 if(is_object)
466 switch (t)
468 case 1: return D3D10_SVT_STRING;
469 case 2: return D3D10_SVT_BLEND;
470 case 3: return D3D10_SVT_DEPTHSTENCIL;
471 case 4: return D3D10_SVT_RASTERIZER;
472 case 5: return D3D10_SVT_PIXELSHADER;
473 case 6: return D3D10_SVT_VERTEXSHADER;
474 case 7: return D3D10_SVT_GEOMETRYSHADER;
476 case 10: return D3D10_SVT_TEXTURE1D;
477 case 11: return D3D10_SVT_TEXTURE1DARRAY;
478 case 12: return D3D10_SVT_TEXTURE2D;
479 case 13: return D3D10_SVT_TEXTURE2DARRAY;
480 case 14: return D3D10_SVT_TEXTURE2DMS;
481 case 15: return D3D10_SVT_TEXTURE2DMSARRAY;
482 case 16: return D3D10_SVT_TEXTURE3D;
483 case 17: return D3D10_SVT_TEXTURECUBE;
485 case 19: return D3D10_SVT_RENDERTARGETVIEW;
486 case 20: return D3D10_SVT_DEPTHSTENCILVIEW;
487 case 21: return D3D10_SVT_SAMPLER;
488 case 22: return D3D10_SVT_BUFFER;
489 default:
490 FIXME("Unknown variable type %#x.\n", t);
491 return D3D10_SVT_VOID;
494 else
496 switch (t)
498 case 1: return D3D10_SVT_FLOAT;
499 case 2: return D3D10_SVT_INT;
500 case 3: return D3D10_SVT_UINT;
501 case 4: return D3D10_SVT_BOOL;
502 default:
503 FIXME("Unknown variable type %#x.\n", t);
504 return D3D10_SVT_VOID;
509 static HRESULT parse_fx10_type(struct d3d10_effect_type *t, const char *ptr, const char *data)
511 DWORD unknown0;
512 DWORD offset;
513 DWORD typeinfo;
514 unsigned int i;
516 read_dword(&ptr, &offset);
517 TRACE("Type name at offset %#x.\n", offset);
519 if (!copy_name(data + offset, &t->name))
521 ERR("Failed to copy name.\n");
522 return E_OUTOFMEMORY;
524 TRACE("Type name: %s.\n", debugstr_a(t->name));
526 read_dword(&ptr, &unknown0);
527 TRACE("Unknown 0: %u.\n", unknown0);
529 read_dword(&ptr, &t->element_count);
530 TRACE("Element count: %u.\n", t->element_count);
532 read_dword(&ptr, &t->size_unpacked);
533 TRACE("Unpacked size: %#x.\n", t->size_unpacked);
535 read_dword(&ptr, &t->stride);
536 TRACE("Stride: %#x.\n", t->stride);
538 read_dword(&ptr, &t->size_packed);
539 TRACE("Packed size %#x.\n", t->size_packed);
541 switch (unknown0)
543 case 1:
544 t->member_count = 0;
546 read_dword(&ptr, &typeinfo);
547 t->column_count = (typeinfo & D3D10_FX10_TYPE_COLUMN_MASK) >> D3D10_FX10_TYPE_COLUMN_SHIFT;
548 t->row_count = (typeinfo & D3D10_FX10_TYPE_ROW_MASK) >> D3D10_FX10_TYPE_ROW_SHIFT;
549 t->basetype = d3d10_variable_type((typeinfo & D3D10_FX10_TYPE_BASETYPE_MASK) >> D3D10_FX10_TYPE_BASETYPE_SHIFT, FALSE);
550 t->type_class = d3d10_variable_class((typeinfo & D3D10_FX10_TYPE_CLASS_MASK) >> D3D10_FX10_TYPE_CLASS_SHIFT, typeinfo & D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK);
552 TRACE("Type description: %#x.\n", typeinfo);
553 TRACE("\tcolumns: %u.\n", t->column_count);
554 TRACE("\trows: %u.\n", t->row_count);
555 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
556 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
557 TRACE("\tunknown bits: %#x.\n", typeinfo & ~(D3D10_FX10_TYPE_COLUMN_MASK | D3D10_FX10_TYPE_ROW_MASK
558 | D3D10_FX10_TYPE_BASETYPE_MASK | D3D10_FX10_TYPE_CLASS_MASK | D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK));
559 break;
561 case 2:
562 TRACE("Type is an object.\n");
564 t->member_count = 0;
565 t->column_count = 0;
566 t->row_count = 0;
567 t->type_class = D3D10_SVC_OBJECT;
569 read_dword(&ptr, &typeinfo);
570 t->basetype = d3d10_variable_type(typeinfo, TRUE);
572 TRACE("Type description: %#x.\n", typeinfo);
573 TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
574 TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
575 break;
577 case 3:
578 TRACE("Type is a structure.\n");
580 read_dword(&ptr, &t->member_count);
581 TRACE("Member count: %u.\n", t->member_count);
583 t->column_count = 0;
584 t->row_count = 0;
585 t->basetype = 0;
586 t->type_class = D3D10_SVC_STRUCT;
588 t->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->member_count * sizeof(*t->members));
589 if (!t->members)
591 ERR("Failed to allocate members memory.\n");
592 return E_OUTOFMEMORY;
595 for (i = 0; i < t->member_count; ++i)
597 struct d3d10_effect_type_member *typem = &t->members[i];
599 read_dword(&ptr, &offset);
600 TRACE("Member name at offset %#x.\n", offset);
602 if (!copy_name(data + offset, &typem->name))
604 ERR("Failed to copy name.\n");
605 return E_OUTOFMEMORY;
607 TRACE("Member name: %s.\n", debugstr_a(typem->name));
609 read_dword(&ptr, &offset);
610 TRACE("Member semantic at offset %#x.\n", offset);
612 if (!copy_name(data + offset, &typem->semantic))
614 ERR("Failed to copy semantic.\n");
615 return E_OUTOFMEMORY;
617 TRACE("Member semantic: %s.\n", debugstr_a(typem->semantic));
619 read_dword(&ptr, &typem->buffer_offset);
620 TRACE("Member offset in struct: %#x.\n", typem->buffer_offset);
622 read_dword(&ptr, &offset);
623 TRACE("Member type info at offset %#x.\n", offset);
625 typem->type = get_fx10_type(t->effect, data, offset);
626 if (!typem->type)
628 ERR("Failed to get variable type.\n");
629 return E_FAIL;
632 break;
634 default:
635 FIXME("Unhandled case %#x.\n", unknown0);
636 return E_FAIL;
639 if (t->element_count)
641 TRACE("Elementtype for type at offset: %#x\n", t->id);
643 /* allocate elementtype - we need only one, because all elements have the same type */
644 t->elementtype = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*t->elementtype));
645 if (!t->elementtype)
647 ERR("Failed to allocate members memory.\n");
648 return E_OUTOFMEMORY;
651 /* create a copy of the original type with some minor changes */
652 t->elementtype->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
653 t->elementtype->effect = t->effect;
655 if (!copy_name(t->name, &t->elementtype->name))
657 ERR("Failed to copy name.\n");
658 return E_OUTOFMEMORY;
660 TRACE("\tType name: %s.\n", debugstr_a(t->elementtype->name));
662 t->elementtype->element_count = 0;
663 TRACE("\tElement count: %u.\n", t->elementtype->element_count);
666 * Not sure if this calculation is 100% correct, but a test
667 * shows that these values work.
669 t->elementtype->size_unpacked = t->size_packed / t->element_count;
670 TRACE("\tUnpacked size: %#x.\n", t->elementtype->size_unpacked);
672 t->elementtype->stride = t->stride;
673 TRACE("\tStride: %#x.\n", t->elementtype->stride);
675 t->elementtype->size_packed = t->size_packed / t->element_count;
676 TRACE("\tPacked size: %#x.\n", t->elementtype->size_packed);
678 t->elementtype->member_count = t->member_count;
679 TRACE("\tMember count: %u.\n", t->elementtype->member_count);
681 t->elementtype->column_count = t->column_count;
682 TRACE("\tColumns: %u.\n", t->elementtype->column_count);
684 t->elementtype->row_count = t->row_count;
685 TRACE("\tRows: %u.\n", t->elementtype->row_count);
687 t->elementtype->basetype = t->basetype;
688 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(t->elementtype->basetype));
690 t->elementtype->type_class = t->type_class;
691 TRACE("\tClass: %s.\n", debug_d3d10_shader_variable_class(t->elementtype->type_class));
693 t->elementtype->members = t->members;
696 return S_OK;
699 static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset)
701 struct d3d10_effect_type *type;
702 struct wine_rb_entry *entry;
703 HRESULT hr;
705 entry = wine_rb_get(&effect->types, &offset);
706 if (entry)
708 TRACE("Returning existing type.\n");
709 return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
712 type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*type));
713 if (!type)
715 ERR("Failed to allocate type memory.\n");
716 return NULL;
719 type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
720 type->id = offset;
721 type->effect = effect;
722 hr = parse_fx10_type(type, data + offset, data);
723 if (FAILED(hr))
725 ERR("Failed to parse type info, hr %#x.\n", hr);
726 HeapFree(GetProcessHeap(), 0, type);
727 return NULL;
730 if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
732 ERR("Failed to insert type entry.\n");
733 HeapFree(GetProcessHeap(), 0, type);
734 return NULL;
737 return type;
740 static void set_variable_vtbl(struct d3d10_effect_variable *v)
742 const ID3D10EffectVariableVtbl **vtbl = &v->ID3D10EffectVariable_iface.lpVtbl;
744 switch (v->type->type_class)
746 case D3D10_SVC_SCALAR:
747 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl;
748 break;
750 case D3D10_SVC_VECTOR:
751 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl;
752 break;
754 case D3D10_SVC_MATRIX_ROWS:
755 case D3D10_SVC_MATRIX_COLUMNS:
756 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl;
757 break;
759 case D3D10_SVC_STRUCT:
760 *vtbl = &d3d10_effect_variable_vtbl;
761 break;
763 case D3D10_SVC_OBJECT:
764 switch(v->type->basetype)
766 case D3D10_SVT_STRING:
767 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl;
768 break;
770 case D3D10_SVT_TEXTURE1D:
771 case D3D10_SVT_TEXTURE1DARRAY:
772 case D3D10_SVT_TEXTURE2D:
773 case D3D10_SVT_TEXTURE2DARRAY:
774 case D3D10_SVT_TEXTURE2DMS:
775 case D3D10_SVT_TEXTURE2DMSARRAY:
776 case D3D10_SVT_TEXTURE3D:
777 case D3D10_SVT_TEXTURECUBE:
778 case D3D10_SVT_BUFFER: /* Either resource or constant buffer. */
779 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl;
780 break;
782 case D3D10_SVT_RENDERTARGETVIEW:
783 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl;
784 break;
786 case D3D10_SVT_DEPTHSTENCILVIEW:
787 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl;
788 break;
790 case D3D10_SVT_DEPTHSTENCIL:
791 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl;
792 break;
794 case D3D10_SVT_VERTEXSHADER:
795 case D3D10_SVT_GEOMETRYSHADER:
796 case D3D10_SVT_PIXELSHADER:
797 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl;
798 break;
800 case D3D10_SVT_BLEND:
801 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl;
802 break;
804 case D3D10_SVT_RASTERIZER:
805 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl;
806 break;
808 case D3D10_SVT_SAMPLER:
809 *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl;
810 break;
812 default:
813 FIXME("Unhandled basetype %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
814 *vtbl = &d3d10_effect_variable_vtbl;
815 break;
817 break;
819 default:
820 FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class));
821 *vtbl = &d3d10_effect_variable_vtbl;
822 break;
826 static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
828 unsigned int i;
829 HRESULT hr;
831 if (v->type->member_count)
833 v->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->member_count * sizeof(*v->members));
834 if (!v->members)
836 ERR("Failed to allocate members memory.\n");
837 return E_OUTOFMEMORY;
840 for (i = 0; i < v->type->member_count; ++i)
842 struct d3d10_effect_variable *var = &v->members[i];
843 struct d3d10_effect_type_member *typem = &v->type->members[i];
845 var->buffer = v->buffer;
846 var->effect = v->effect;
847 var->type = typem->type;
848 set_variable_vtbl(var);
850 if (!copy_name(typem->name, &var->name))
852 ERR("Failed to copy name.\n");
853 return E_OUTOFMEMORY;
855 TRACE("Variable name: %s.\n", debugstr_a(var->name));
857 if (!copy_name(typem->semantic, &var->semantic))
859 ERR("Failed to copy name.\n");
860 return E_OUTOFMEMORY;
862 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
864 var->buffer_offset = v->buffer_offset + typem->buffer_offset;
865 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
867 hr = copy_variableinfo_from_type(var);
868 if (FAILED(hr)) return hr;
872 if (v->type->element_count)
874 unsigned int bufferoffset = v->buffer_offset;
876 v->elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->element_count * sizeof(*v->elements));
877 if (!v->elements)
879 ERR("Failed to allocate elements memory.\n");
880 return E_OUTOFMEMORY;
883 for (i = 0; i < v->type->element_count; ++i)
885 struct d3d10_effect_variable *var = &v->elements[i];
887 var->buffer = v->buffer;
888 var->effect = v->effect;
889 var->type = v->type->elementtype;
890 set_variable_vtbl(var);
892 if (!copy_name(v->name, &var->name))
894 ERR("Failed to copy name.\n");
895 return E_OUTOFMEMORY;
897 TRACE("Variable name: %s.\n", debugstr_a(var->name));
899 if (!copy_name(v->semantic, &var->semantic))
901 ERR("Failed to copy name.\n");
902 return E_OUTOFMEMORY;
904 TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic));
906 if (i != 0)
908 bufferoffset += v->type->stride;
910 var->buffer_offset = bufferoffset;
911 TRACE("Variable buffer offset: %u.\n", var->buffer_offset);
913 hr = copy_variableinfo_from_type(var);
914 if (FAILED(hr)) return hr;
918 return S_OK;
921 static HRESULT parse_fx10_variable_head(struct d3d10_effect_variable *v, const char **ptr, const char *data)
923 DWORD offset;
925 read_dword(ptr, &offset);
926 TRACE("Variable name at offset %#x.\n", offset);
928 if (!copy_name(data + offset, &v->name))
930 ERR("Failed to copy name.\n");
931 return E_OUTOFMEMORY;
933 TRACE("Variable name: %s.\n", debugstr_a(v->name));
935 read_dword(ptr, &offset);
936 TRACE("Variable type info at offset %#x.\n", offset);
938 v->type = get_fx10_type(v->effect, data, offset);
939 if (!v->type)
941 ERR("Failed to get variable type.\n");
942 return E_FAIL;
944 set_variable_vtbl(v);
946 return copy_variableinfo_from_type(v);
949 static HRESULT parse_fx10_annotation(struct d3d10_effect_variable *a, const char **ptr, const char *data)
951 HRESULT hr;
953 hr = parse_fx10_variable_head(a, ptr, data);
954 if (FAILED(hr)) return hr;
956 skip_dword_unknown("annotation", ptr, 1);
958 /* mark the variable as annotation */
959 a->flag = D3D10_EFFECT_VARIABLE_ANNOTATION;
961 return S_OK;
964 static HRESULT parse_fx10_anonymous_shader(struct d3d10_effect *e, struct d3d10_effect_anonymous_shader *s,
965 enum d3d10_effect_object_type otype)
967 struct d3d10_effect_variable *v = &s->shader;
968 struct d3d10_effect_type *t = &s->type;
969 const char *shader = NULL;
971 switch (otype)
973 case D3D10_EOT_VERTEXSHADER:
974 shader = "vertexshader";
975 t->basetype = D3D10_SVT_VERTEXSHADER;
976 break;
978 case D3D10_EOT_PIXELSHADER:
979 shader = "pixelshader";
980 t->basetype = D3D10_SVT_PIXELSHADER;
981 break;
983 case D3D10_EOT_GEOMETRYSHADER:
984 shader = "geometryshader";
985 t->basetype = D3D10_SVT_GEOMETRYSHADER;
986 break;
988 default:
989 FIXME("Unhandled object type %#x.\n", otype);
990 return E_FAIL;
993 if (!copy_name(shader, &t->name))
995 ERR("Failed to copy name.\n");
996 return E_OUTOFMEMORY;
998 TRACE("Type name: %s.\n", debugstr_a(t->name));
1000 t->type_class = D3D10_SVC_OBJECT;
1002 t->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1004 v->type = t;
1005 v->effect = e;
1006 set_variable_vtbl(v);
1008 if (!copy_name("$Anonymous", &v->name))
1010 ERR("Failed to copy semantic.\n");
1011 return E_OUTOFMEMORY;
1013 TRACE("Variable name: %s.\n", debugstr_a(v->name));
1015 if (!copy_name(NULL, &v->semantic))
1017 ERR("Failed to copy semantic.\n");
1018 return E_OUTOFMEMORY;
1020 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1022 return S_OK;
1025 static const struct d3d10_effect_state_property_info *get_property_info(UINT id)
1027 unsigned int i;
1029 for (i = 0; i < sizeof(property_info) / sizeof(*property_info); ++i)
1031 if (property_info[i].id == id)
1032 return &property_info[i];
1035 return NULL;
1038 static const struct d3d10_effect_state_storage_info *get_storage_info(D3D_SHADER_VARIABLE_TYPE id)
1040 unsigned int i;
1042 for (i = 0; i < sizeof(d3d10_effect_state_storage_info) / sizeof(*d3d10_effect_state_storage_info); ++i)
1044 if (d3d10_effect_state_storage_info[i].id == id)
1045 return &d3d10_effect_state_storage_info[i];
1048 return NULL;
1051 static BOOL read_float_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, float *out_data, UINT idx)
1053 switch (in_type)
1055 case D3D10_SVT_FLOAT:
1056 out_data[idx] = *(float *)&value;
1057 return TRUE;
1059 case D3D10_SVT_INT:
1060 out_data[idx] = (INT)value;
1061 return TRUE;
1063 default:
1064 FIXME("Unhandled in_type %#x.\n", in_type);
1065 return FALSE;
1069 static BOOL read_int32_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT *out_data, UINT idx)
1071 switch (in_type)
1073 case D3D10_SVT_FLOAT:
1074 out_data[idx] = *(float *)&value;
1075 return TRUE;
1077 case D3D10_SVT_INT:
1078 case D3D10_SVT_UINT:
1079 case D3D10_SVT_BOOL:
1080 out_data[idx] = value;
1081 return TRUE;
1083 default:
1084 FIXME("Unhandled in_type %#x.\n", in_type);
1085 return FALSE;
1089 static BOOL read_int8_value(DWORD value, D3D_SHADER_VARIABLE_TYPE in_type, INT8 *out_data, UINT idx)
1091 switch (in_type)
1093 case D3D10_SVT_INT:
1094 case D3D10_SVT_UINT:
1095 out_data[idx] = value;
1096 return TRUE;
1098 default:
1099 FIXME("Unhandled in_type %#x.\n", in_type);
1100 return FALSE;
1104 static BOOL read_value_list(const char *ptr, D3D_SHADER_VARIABLE_TYPE out_type,
1105 UINT out_base, UINT out_size, void *out_data)
1107 D3D_SHADER_VARIABLE_TYPE in_type;
1108 DWORD t, value;
1109 DWORD count, i;
1111 read_dword(&ptr, &count);
1112 if (count != out_size)
1113 return FALSE;
1115 TRACE("%u values:\n", count);
1116 for (i = 0; i < count; ++i)
1118 UINT out_idx = out_base * out_size + i;
1120 read_dword(&ptr, &t);
1121 read_dword(&ptr, &value);
1123 in_type = d3d10_variable_type(t, FALSE);
1124 TRACE("\t%s: %#x.\n", debug_d3d10_shader_variable_type(in_type), value);
1126 switch (out_type)
1128 case D3D10_SVT_FLOAT:
1129 if (!read_float_value(value, in_type, out_data, out_idx))
1130 return FALSE;
1131 break;
1133 case D3D10_SVT_INT:
1134 case D3D10_SVT_UINT:
1135 case D3D10_SVT_BOOL:
1136 if (!read_int32_value(value, in_type, out_data, out_idx))
1137 return FALSE;
1138 break;
1140 case D3D10_SVT_UINT8:
1141 if (!read_int8_value(value, in_type, out_data, out_idx))
1142 return FALSE;
1143 break;
1145 default:
1146 FIXME("Unhandled out_type %#x.\n", out_type);
1147 return FALSE;
1151 return TRUE;
1154 static BOOL parse_fx10_state_group(const char **ptr, const char *data,
1155 D3D_SHADER_VARIABLE_TYPE container_type, void *container)
1157 const struct d3d10_effect_state_property_info *property_info;
1158 UINT value_offset;
1159 unsigned int i;
1160 DWORD count;
1161 UINT idx;
1162 UINT id;
1164 read_dword(ptr, &count);
1165 TRACE("Property count: %#x.\n", count);
1167 for (i = 0; i < count; ++i)
1169 read_dword(ptr, &id);
1170 read_dword(ptr, &idx);
1171 skip_dword_unknown("read property", ptr, 1);
1172 read_dword(ptr, &value_offset);
1174 if (!(property_info = get_property_info(id)))
1176 FIXME("Failed to find property info for property %#x.\n", id);
1177 return FALSE;
1180 TRACE("Property %s[%#x] = value list @ offset %#x.\n",
1181 property_info->name, idx, value_offset);
1183 if (property_info->container_type != container_type)
1185 ERR("Invalid container type %#x for property %#x.\n", container_type, id);
1186 return FALSE;
1189 if (idx >= property_info->count)
1191 ERR("Invalid index %#x for property %#x.\n", idx, id);
1192 return FALSE;
1195 if (!read_value_list(data + value_offset, property_info->type, idx,
1196 property_info->size, (char *)container + property_info->offset))
1198 ERR("Failed to read values for property %#x.\n", id);
1199 return FALSE;
1203 return TRUE;
1206 static HRESULT parse_fx10_object(struct d3d10_effect_object *o, const char **ptr, const char *data)
1208 ID3D10EffectVariable *variable = &null_variable.ID3D10EffectVariable_iface;
1209 const char *data_ptr = NULL;
1210 DWORD offset;
1211 enum d3d10_effect_object_operation operation;
1212 HRESULT hr;
1213 struct d3d10_effect *effect = o->pass->technique->effect;
1214 ID3D10Effect *e = &effect->ID3D10Effect_iface;
1215 DWORD tmp, variable_idx = 0;
1217 read_dword(ptr, &o->type);
1218 TRACE("Effect object is of type %#x.\n", o->type);
1220 read_dword(ptr, &tmp);
1221 TRACE("Effect object index %#x.\n", tmp);
1223 read_dword(ptr, &operation);
1224 TRACE("Effect object operation %#x.\n", operation);
1226 read_dword(ptr, &offset);
1227 TRACE("Effect object idx is at offset %#x.\n", offset);
1229 switch(operation)
1231 case D3D10_EOO_VALUE:
1232 TRACE("Copy variable values\n");
1234 switch (o->type)
1236 case D3D10_EOT_VERTEXSHADER:
1237 TRACE("Vertex shader\n");
1238 variable = &anonymous_vs.ID3D10EffectVariable_iface;
1239 break;
1241 case D3D10_EOT_PIXELSHADER:
1242 TRACE("Pixel shader\n");
1243 variable = &anonymous_ps.ID3D10EffectVariable_iface;
1244 break;
1246 case D3D10_EOT_GEOMETRYSHADER:
1247 TRACE("Geometry shader\n");
1248 variable = &anonymous_gs.ID3D10EffectVariable_iface;
1249 break;
1251 case D3D10_EOT_STENCIL_REF:
1252 if (!read_value_list(data + offset, D3D10_SVT_UINT, 0, 1, &o->pass->stencil_ref))
1254 ERR("Failed to read stencil ref.\n");
1255 return E_FAIL;
1257 break;
1259 case D3D10_EOT_SAMPLE_MASK:
1260 if (!read_value_list(data + offset, D3D10_SVT_UINT, 0, 1, &o->pass->sample_mask))
1262 FIXME("Failed to read sample mask.\n");
1263 return E_FAIL;
1265 break;
1267 case D3D10_EOT_BLEND_FACTOR:
1268 if (!read_value_list(data + offset, D3D10_SVT_FLOAT, 0, 4, &o->pass->blend_factor[0]))
1270 FIXME("Failed to read blend factor.\n");
1271 return E_FAIL;
1273 break;
1275 default:
1276 FIXME("Unhandled object type %#x\n", o->type);
1277 return E_FAIL;
1279 break;
1281 case D3D10_EOO_PARSED_OBJECT:
1282 /* This is a local object, we've parsed in parse_fx10_local_object. */
1283 TRACE("Variable name %s.\n", debugstr_a(data + offset));
1285 variable = e->lpVtbl->GetVariableByName(e, data + offset);
1286 break;
1288 case D3D10_EOO_PARSED_OBJECT_INDEX:
1289 /* This is a local object, we've parsed in parse_fx10_local_object, which has an array index. */
1290 data_ptr = data + offset;
1291 read_dword(&data_ptr, &offset);
1292 read_dword(&data_ptr, &variable_idx);
1293 TRACE("Variable name %s[%u].\n", debugstr_a(data + offset), variable_idx);
1295 variable = e->lpVtbl->GetVariableByName(e, data + offset);
1296 break;
1298 case D3D10_EOO_ANONYMOUS_SHADER:
1299 TRACE("Anonymous shader\n");
1301 /* check anonymous_shader_current for validity */
1302 if (effect->anonymous_shader_current >= effect->anonymous_shader_count)
1304 ERR("Anonymous shader count is wrong!\n");
1305 return E_FAIL;
1308 data_ptr = data + offset;
1309 read_dword(&data_ptr, &offset);
1310 TRACE("Effect object starts at offset %#x.\n", offset);
1312 data_ptr = data + offset;
1314 hr = parse_fx10_anonymous_shader(effect, &effect->anonymous_shaders[effect->anonymous_shader_current], o->type);
1315 if (FAILED(hr)) return hr;
1317 variable = &effect->anonymous_shaders[effect->anonymous_shader_current].shader.ID3D10EffectVariable_iface;
1318 ++effect->anonymous_shader_current;
1320 switch (o->type)
1322 case D3D10_EOT_VERTEXSHADER:
1323 case D3D10_EOT_PIXELSHADER:
1324 case D3D10_EOT_GEOMETRYSHADER:
1325 if (FAILED(hr = parse_shader(variable, data_ptr)))
1326 return hr;
1327 break;
1329 default:
1330 FIXME("Unhandled object type %#x\n", o->type);
1331 return E_FAIL;
1333 break;
1335 default:
1336 FIXME("Unhandled operation %#x.\n", operation);
1337 return E_FAIL;
1340 switch (o->type)
1342 case D3D10_EOT_RASTERIZER_STATE:
1344 ID3D10EffectRasterizerVariable *rv = variable->lpVtbl->AsRasterizer(variable);
1345 if (FAILED(hr = rv->lpVtbl->GetRasterizerState(rv, variable_idx, &o->object.rs)))
1346 return hr;
1347 break;
1350 case D3D10_EOT_DEPTH_STENCIL_STATE:
1352 ID3D10EffectDepthStencilVariable *dv = variable->lpVtbl->AsDepthStencil(variable);
1353 if (FAILED(hr = dv->lpVtbl->GetDepthStencilState(dv, variable_idx, &o->object.ds)))
1354 return hr;
1355 break;
1358 case D3D10_EOT_BLEND_STATE:
1360 ID3D10EffectBlendVariable *bv = variable->lpVtbl->AsBlend(variable);
1361 if (FAILED(hr = bv->lpVtbl->GetBlendState(bv, variable_idx, &o->object.bs)))
1362 return hr;
1363 break;
1366 case D3D10_EOT_VERTEXSHADER:
1368 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1369 if (FAILED(hr = sv->lpVtbl->GetVertexShader(sv, variable_idx, &o->object.vs)))
1370 return hr;
1371 o->pass->vs.pShaderVariable = sv;
1372 o->pass->vs.ShaderIndex = variable_idx;
1373 break;
1376 case D3D10_EOT_PIXELSHADER:
1378 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1379 if (FAILED(hr = sv->lpVtbl->GetPixelShader(sv, variable_idx, &o->object.ps)))
1380 return hr;
1381 o->pass->ps.pShaderVariable = sv;
1382 o->pass->ps.ShaderIndex = variable_idx;
1383 break;
1386 case D3D10_EOT_GEOMETRYSHADER:
1388 ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
1389 if (FAILED(hr = sv->lpVtbl->GetGeometryShader(sv, variable_idx, &o->object.gs)))
1390 return hr;
1391 o->pass->gs.pShaderVariable = sv;
1392 o->pass->gs.ShaderIndex = variable_idx;
1393 break;
1396 case D3D10_EOT_STENCIL_REF:
1397 case D3D10_EOT_BLEND_FACTOR:
1398 case D3D10_EOT_SAMPLE_MASK:
1399 break;
1401 default:
1402 FIXME("Unhandled object type %#x.\n", o->type);
1403 return E_FAIL;
1406 return S_OK;
1409 static HRESULT parse_fx10_pass(struct d3d10_effect_pass *p, const char **ptr, const char *data)
1411 HRESULT hr = S_OK;
1412 unsigned int i;
1413 DWORD offset;
1415 read_dword(ptr, &offset);
1416 TRACE("Pass name at offset %#x.\n", offset);
1418 if (!copy_name(data + offset, &p->name))
1420 ERR("Failed to copy name.\n");
1421 return E_OUTOFMEMORY;
1423 TRACE("Pass name: %s.\n", debugstr_a(p->name));
1425 read_dword(ptr, &p->object_count);
1426 TRACE("Pass has %u effect objects.\n", p->object_count);
1428 read_dword(ptr, &p->annotation_count);
1429 TRACE("Pass has %u annotations.\n", p->annotation_count);
1431 p->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->annotation_count * sizeof(*p->annotations));
1432 if (!p->annotations)
1434 ERR("Failed to allocate pass annotations memory.\n");
1435 return E_OUTOFMEMORY;
1438 for (i = 0; i < p->annotation_count; ++i)
1440 struct d3d10_effect_variable *a = &p->annotations[i];
1442 a->effect = p->technique->effect;
1443 a->buffer = &null_local_buffer;
1445 hr = parse_fx10_annotation(a, ptr, data);
1446 if (FAILED(hr)) return hr;
1449 p->objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, p->object_count * sizeof(*p->objects));
1450 if (!p->objects)
1452 ERR("Failed to allocate effect objects memory.\n");
1453 return E_OUTOFMEMORY;
1456 p->vs.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1457 p->ps.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1458 p->gs.pShaderVariable = (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
1460 for (i = 0; i < p->object_count; ++i)
1462 struct d3d10_effect_object *o = &p->objects[i];
1464 o->pass = p;
1466 hr = parse_fx10_object(o, ptr, data);
1467 if (FAILED(hr)) return hr;
1470 return hr;
1473 static HRESULT parse_fx10_technique(struct d3d10_effect_technique *t, const char **ptr, const char *data)
1475 unsigned int i;
1476 DWORD offset;
1477 HRESULT hr;
1479 read_dword(ptr, &offset);
1480 TRACE("Technique name at offset %#x.\n", offset);
1482 if (!copy_name(data + offset, &t->name))
1484 ERR("Failed to copy name.\n");
1485 return E_OUTOFMEMORY;
1487 TRACE("Technique name: %s.\n", debugstr_a(t->name));
1489 read_dword(ptr, &t->pass_count);
1490 TRACE("Technique has %u passes\n", t->pass_count);
1492 read_dword(ptr, &t->annotation_count);
1493 TRACE("Technique has %u annotations.\n", t->annotation_count);
1495 t->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->annotation_count * sizeof(*t->annotations));
1496 if (!t->annotations)
1498 ERR("Failed to allocate technique annotations memory.\n");
1499 return E_OUTOFMEMORY;
1502 for (i = 0; i < t->annotation_count; ++i)
1504 struct d3d10_effect_variable *a = &t->annotations[i];
1506 a->effect = t->effect;
1507 a->buffer = &null_local_buffer;
1509 hr = parse_fx10_annotation(a, ptr, data);
1510 if (FAILED(hr)) return hr;
1513 t->passes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->pass_count * sizeof(*t->passes));
1514 if (!t->passes)
1516 ERR("Failed to allocate passes memory\n");
1517 return E_OUTOFMEMORY;
1520 for (i = 0; i < t->pass_count; ++i)
1522 struct d3d10_effect_pass *p = &t->passes[i];
1524 p->ID3D10EffectPass_iface.lpVtbl = &d3d10_effect_pass_vtbl;
1525 p->technique = t;
1527 hr = parse_fx10_pass(p, ptr, data);
1528 if (FAILED(hr)) return hr;
1531 return S_OK;
1534 static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
1536 DWORD offset;
1537 unsigned int i;
1538 HRESULT hr;
1540 hr = parse_fx10_variable_head(v, ptr, data);
1541 if (FAILED(hr)) return hr;
1543 read_dword(ptr, &offset);
1544 TRACE("Variable semantic at offset %#x.\n", offset);
1546 if (!copy_name(data + offset, &v->semantic))
1548 ERR("Failed to copy semantic.\n");
1549 return E_OUTOFMEMORY;
1551 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1553 read_dword(ptr, &v->buffer_offset);
1554 TRACE("Variable offset in buffer: %#x.\n", v->buffer_offset);
1556 skip_dword_unknown("variable", ptr, 1);
1558 read_dword(ptr, &v->flag);
1559 TRACE("Variable flag: %#x.\n", v->flag);
1561 read_dword(ptr, &v->annotation_count);
1562 TRACE("Variable has %u annotations.\n", v->annotation_count);
1564 v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1565 if (!v->annotations)
1567 ERR("Failed to allocate variable annotations memory.\n");
1568 return E_OUTOFMEMORY;
1571 for (i = 0; i < v->annotation_count; ++i)
1573 struct d3d10_effect_variable *a = &v->annotations[i];
1575 a->effect = v->effect;
1576 a->buffer = &null_local_buffer;
1578 hr = parse_fx10_annotation(a, ptr, data);
1579 if (FAILED(hr)) return hr;
1582 return S_OK;
1585 static HRESULT create_state_object(struct d3d10_effect_variable *v)
1587 ID3D10Device *device = v->effect->device;
1588 HRESULT hr;
1590 switch (v->type->basetype)
1592 case D3D10_SVT_DEPTHSTENCIL:
1593 if (FAILED(hr = ID3D10Device_CreateDepthStencilState(device,
1594 &v->u.state.desc.depth_stencil, &v->u.state.object.depth_stencil)))
1595 return hr;
1596 break;
1598 case D3D10_SVT_BLEND:
1599 if (FAILED(hr = ID3D10Device_CreateBlendState(device,
1600 &v->u.state.desc.blend, &v->u.state.object.blend)))
1601 return hr;
1602 break;
1604 case D3D10_SVT_RASTERIZER:
1605 if (FAILED(hr = ID3D10Device_CreateRasterizerState(device,
1606 &v->u.state.desc.rasterizer, &v->u.state.object.rasterizer)))
1607 return hr;
1608 break;
1610 case D3D10_SVT_SAMPLER:
1611 if (FAILED(hr = ID3D10Device_CreateSamplerState(device,
1612 &v->u.state.desc.sampler, &v->u.state.object.sampler)))
1613 return hr;
1614 break;
1616 default:
1617 ERR("Unhandled variable type %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1618 return E_FAIL;
1621 return S_OK;
1624 static HRESULT parse_fx10_local_variable(struct d3d10_effect_variable *v, const char **ptr, const char *data)
1626 unsigned int i;
1627 HRESULT hr;
1628 DWORD offset;
1630 hr = parse_fx10_variable_head(v, ptr, data);
1631 if (FAILED(hr)) return hr;
1633 read_dword(ptr, &offset);
1634 TRACE("Variable semantic at offset %#x.\n", offset);
1636 if (!copy_name(data + offset, &v->semantic))
1638 ERR("Failed to copy semantic.\n");
1639 return E_OUTOFMEMORY;
1641 TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
1643 skip_dword_unknown("local variable", ptr, 1);
1645 switch (v->type->basetype)
1647 case D3D10_SVT_TEXTURE1D:
1648 case D3D10_SVT_TEXTURE1DARRAY:
1649 case D3D10_SVT_TEXTURE2D:
1650 case D3D10_SVT_TEXTURE2DARRAY:
1651 case D3D10_SVT_TEXTURE2DMS:
1652 case D3D10_SVT_TEXTURE2DMSARRAY:
1653 case D3D10_SVT_TEXTURE3D:
1654 case D3D10_SVT_TEXTURECUBE:
1655 case D3D10_SVT_RENDERTARGETVIEW:
1656 case D3D10_SVT_DEPTHSTENCILVIEW:
1657 case D3D10_SVT_BUFFER:
1658 TRACE("SVT could not have elements.\n");
1659 break;
1661 case D3D10_SVT_VERTEXSHADER:
1662 case D3D10_SVT_PIXELSHADER:
1663 case D3D10_SVT_GEOMETRYSHADER:
1664 TRACE("Shader type is %s\n", debug_d3d10_shader_variable_type(v->type->basetype));
1665 for (i = 0; i < max(v->type->element_count, 1); ++i)
1667 DWORD shader_offset;
1668 struct d3d10_effect_variable *var;
1670 if (!v->type->element_count)
1672 var = v;
1674 else
1676 var = &v->elements[i];
1679 read_dword(ptr, &shader_offset);
1680 TRACE("Shader offset: %#x.\n", shader_offset);
1682 hr = parse_shader(&var->ID3D10EffectVariable_iface, data + shader_offset);
1683 if (FAILED(hr)) return hr;
1685 break;
1687 case D3D10_SVT_DEPTHSTENCIL:
1688 case D3D10_SVT_BLEND:
1689 case D3D10_SVT_RASTERIZER:
1690 case D3D10_SVT_SAMPLER:
1692 const struct d3d10_effect_state_storage_info *storage_info;
1693 unsigned int count = max(v->type->element_count, 1);
1695 if (!(storage_info = get_storage_info(v->type->basetype)))
1697 FIXME("Failed to get backing store info for type %s.\n",
1698 debug_d3d10_shader_variable_type(v->type->basetype));
1699 return E_FAIL;
1702 if (storage_info->size > sizeof(v->u.state.desc))
1704 ERR("Invalid storage size %#lx.\n", storage_info->size);
1705 return E_FAIL;
1708 for (i = 0; i < count; ++i)
1710 struct d3d10_effect_variable *var;
1712 if (v->type->element_count)
1713 var = &v->elements[i];
1714 else
1715 var = v;
1717 memcpy(&var->u.state.desc, storage_info->default_state, storage_info->size);
1718 if (!parse_fx10_state_group(ptr, data, var->type->basetype, &var->u.state.desc))
1720 ERR("Failed to read property list.\n");
1721 return E_FAIL;
1724 if (FAILED(hr = create_state_object(v)))
1725 return hr;
1728 break;
1730 default:
1731 FIXME("Unhandled case %s.\n", debug_d3d10_shader_variable_type(v->type->basetype));
1732 return E_FAIL;
1735 read_dword(ptr, &v->annotation_count);
1736 TRACE("Variable has %u annotations.\n", v->annotation_count);
1738 v->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->annotation_count * sizeof(*v->annotations));
1739 if (!v->annotations)
1741 ERR("Failed to allocate variable annotations memory.\n");
1742 return E_OUTOFMEMORY;
1745 for (i = 0; i < v->annotation_count; ++i)
1747 struct d3d10_effect_variable *a = &v->annotations[i];
1749 a->effect = v->effect;
1750 a->buffer = &null_local_buffer;
1752 hr = parse_fx10_annotation(a, ptr, data);
1753 if (FAILED(hr)) return hr;
1756 return S_OK;
1759 static HRESULT parse_fx10_local_buffer(struct d3d10_effect_variable *l, const char **ptr, const char *data)
1761 unsigned int i;
1762 DWORD offset;
1763 D3D10_CBUFFER_TYPE d3d10_cbuffer_type;
1764 HRESULT hr;
1765 unsigned int stride = 0;
1767 /* Generate our own type, it isn't in the fx blob. */
1768 l->type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*l->type));
1769 if (!l->type)
1771 ERR("Failed to allocate local buffer type memory.\n");
1772 return E_OUTOFMEMORY;
1774 l->type->ID3D10EffectType_iface.lpVtbl = &d3d10_effect_type_vtbl;
1775 l->type->type_class = D3D10_SVC_OBJECT;
1776 l->type->effect = l->effect;
1778 read_dword(ptr, &offset);
1779 TRACE("Local buffer name at offset %#x.\n", offset);
1781 if (!copy_name(data + offset, &l->name))
1783 ERR("Failed to copy name.\n");
1784 return E_OUTOFMEMORY;
1786 TRACE("Local buffer name: %s.\n", debugstr_a(l->name));
1788 read_dword(ptr, &l->data_size);
1789 TRACE("Local buffer data size: %#x.\n", l->data_size);
1791 read_dword(ptr, &d3d10_cbuffer_type);
1792 TRACE("Local buffer type: %#x.\n", d3d10_cbuffer_type);
1794 switch(d3d10_cbuffer_type)
1796 case D3D10_CT_CBUFFER:
1797 l->type->basetype = D3D10_SVT_CBUFFER;
1798 if (!copy_name("cbuffer", &l->type->name))
1800 ERR("Failed to copy name.\n");
1801 return E_OUTOFMEMORY;
1803 break;
1805 case D3D10_CT_TBUFFER:
1806 l->type->basetype = D3D10_SVT_TBUFFER;
1807 if (!copy_name("tbuffer", &l->type->name))
1809 ERR("Failed to copy name.\n");
1810 return E_OUTOFMEMORY;
1812 break;
1814 default:
1815 ERR("Unexpected D3D10_CBUFFER_TYPE %#x!\n", d3d10_cbuffer_type);
1816 return E_FAIL;
1819 read_dword(ptr, &l->type->member_count);
1820 TRACE("Local buffer member count: %#x.\n", l->type->member_count);
1822 skip_dword_unknown("local buffer", ptr, 1);
1824 read_dword(ptr, &l->annotation_count);
1825 TRACE("Local buffer has %u annotations.\n", l->annotation_count);
1827 l->annotations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->annotation_count * sizeof(*l->annotations));
1828 if (!l->annotations)
1830 ERR("Failed to allocate local buffer annotations memory.\n");
1831 return E_OUTOFMEMORY;
1834 for (i = 0; i < l->annotation_count; ++i)
1836 struct d3d10_effect_variable *a = &l->annotations[i];
1838 a->effect = l->effect;
1839 a->buffer = &null_local_buffer;
1841 hr = parse_fx10_annotation(a, ptr, data);
1842 if (FAILED(hr)) return hr;
1845 l->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->members));
1846 if (!l->members)
1848 ERR("Failed to allocate members memory.\n");
1849 return E_OUTOFMEMORY;
1852 l->type->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->type->members));
1853 if (!l->type->members)
1855 ERR("Failed to allocate type members memory.\n");
1856 return E_OUTOFMEMORY;
1859 for (i = 0; i < l->type->member_count; ++i)
1861 struct d3d10_effect_variable *v = &l->members[i];
1862 struct d3d10_effect_type_member *typem = &l->type->members[i];
1864 v->buffer = l;
1865 v->effect = l->effect;
1867 hr = parse_fx10_variable(v, ptr, data);
1868 if (FAILED(hr)) return hr;
1871 * Copy the values from the variable type to the constant buffers type
1872 * members structure, because it is our own generated type.
1874 typem->type = v->type;
1876 if (!copy_name(v->name, &typem->name))
1878 ERR("Failed to copy name.\n");
1879 return E_OUTOFMEMORY;
1881 TRACE("Variable name: %s.\n", debugstr_a(typem->name));
1883 if (!copy_name(v->semantic, &typem->semantic))
1885 ERR("Failed to copy name.\n");
1886 return E_OUTOFMEMORY;
1888 TRACE("Variable semantic: %s.\n", debugstr_a(typem->semantic));
1890 typem->buffer_offset = v->buffer_offset;
1891 TRACE("Variable buffer offset: %u.\n", typem->buffer_offset);
1893 l->type->size_packed += v->type->size_packed;
1896 * For the complete constantbuffer the size_unpacked = stride,
1897 * the stride is calculated like this:
1899 * 1) if the constant buffer variables are packed with packoffset
1900 * - stride = the highest used constant
1901 * - the complete stride has to be a multiple of 0x10
1903 * 2) if the constant buffer variables are NOT packed with packoffset
1904 * - sum of unpacked size for all variables which fit in a 0x10 part
1905 * - if the size exceeds a 0x10 part, the rest of the old part is skipped
1906 * and a new part is started
1907 * - if the variable is a struct it is always used a new part
1908 * - the complete stride has to be a multiple of 0x10
1910 * e.g.:
1911 * 0x4, 0x4, 0x4, 0x8, 0x4, 0x14, 0x4
1912 * part 0x10 0x10 0x20 -> 0x40
1914 if (v->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
1916 if ((v->type->size_unpacked + v->buffer_offset) > stride)
1918 stride = v->type->size_unpacked + v->buffer_offset;
1921 else
1923 if (v->type->type_class == D3D10_SVC_STRUCT)
1925 stride = (stride + 0xf) & ~0xf;
1928 if ( ((stride & 0xf) + v->type->size_unpacked) > 0x10)
1930 stride = (stride + 0xf) & ~0xf;
1933 stride += v->type->size_unpacked;
1936 l->type->stride = l->type->size_unpacked = (stride + 0xf) & ~0xf;
1938 TRACE("Constant buffer:\n");
1939 TRACE("\tType name: %s.\n", debugstr_a(l->type->name));
1940 TRACE("\tElement count: %u.\n", l->type->element_count);
1941 TRACE("\tMember count: %u.\n", l->type->member_count);
1942 TRACE("\tUnpacked size: %#x.\n", l->type->size_unpacked);
1943 TRACE("\tStride: %#x.\n", l->type->stride);
1944 TRACE("\tPacked size %#x.\n", l->type->size_packed);
1945 TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype));
1946 TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
1948 return S_OK;
1951 static int d3d10_effect_type_compare(const void *key, const struct wine_rb_entry *entry)
1953 const struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, const struct d3d10_effect_type, entry);
1954 const DWORD *id = key;
1956 return *id - t->id;
1959 static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *typem)
1961 TRACE("effect type member %p.\n", typem);
1963 /* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
1964 HeapFree(GetProcessHeap(), 0, typem->semantic);
1965 HeapFree(GetProcessHeap(), 0, typem->name);
1968 static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
1970 struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
1972 TRACE("effect type %p.\n", t);
1974 if (t->elementtype)
1976 HeapFree(GetProcessHeap(), 0, t->elementtype->name);
1977 HeapFree(GetProcessHeap(), 0, t->elementtype);
1980 if (t->members)
1982 unsigned int i;
1984 for (i = 0; i < t->member_count; ++i)
1986 d3d10_effect_type_member_destroy(&t->members[i]);
1988 HeapFree(GetProcessHeap(), 0, t->members);
1991 HeapFree(GetProcessHeap(), 0, t->name);
1992 HeapFree(GetProcessHeap(), 0, t);
1995 static const struct wine_rb_functions d3d10_effect_type_rb_functions =
1997 d3d10_rb_alloc,
1998 d3d10_rb_realloc,
1999 d3d10_rb_free,
2000 d3d10_effect_type_compare,
2003 static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
2005 const char *ptr = data + e->index_offset;
2006 unsigned int i;
2007 HRESULT hr;
2009 if (wine_rb_init(&e->types, &d3d10_effect_type_rb_functions) == -1)
2011 ERR("Failed to initialize type rbtree.\n");
2012 return E_FAIL;
2015 e->local_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_buffer_count * sizeof(*e->local_buffers));
2016 if (!e->local_buffers)
2018 ERR("Failed to allocate local buffer memory.\n");
2019 return E_OUTOFMEMORY;
2022 e->local_variables = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->local_variable_count * sizeof(*e->local_variables));
2023 if (!e->local_variables)
2025 ERR("Failed to allocate local variable memory.\n");
2026 return E_OUTOFMEMORY;
2029 e->anonymous_shaders = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->anonymous_shader_count * sizeof(*e->anonymous_shaders));
2030 if (!e->anonymous_shaders)
2032 ERR("Failed to allocate anonymous shaders memory\n");
2033 return E_OUTOFMEMORY;
2036 e->used_shaders = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->used_shader_count * sizeof(*e->used_shaders));
2037 if (!e->used_shaders)
2039 ERR("Failed to allocate used shaders memory\n");
2040 return E_OUTOFMEMORY;
2043 e->techniques = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, e->technique_count * sizeof(*e->techniques));
2044 if (!e->techniques)
2046 ERR("Failed to allocate techniques memory\n");
2047 return E_OUTOFMEMORY;
2050 for (i = 0; i < e->local_buffer_count; ++i)
2052 struct d3d10_effect_variable *l = &e->local_buffers[i];
2053 l->ID3D10EffectVariable_iface.lpVtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl;
2054 l->effect = e;
2055 l->buffer = &null_local_buffer;
2057 hr = parse_fx10_local_buffer(l, &ptr, data);
2058 if (FAILED(hr)) return hr;
2061 for (i = 0; i < e->local_variable_count; ++i)
2063 struct d3d10_effect_variable *v = &e->local_variables[i];
2065 v->effect = e;
2066 v->ID3D10EffectVariable_iface.lpVtbl = &d3d10_effect_variable_vtbl;
2067 v->buffer = &null_local_buffer;
2069 hr = parse_fx10_local_variable(v, &ptr, data);
2070 if (FAILED(hr)) return hr;
2073 for (i = 0; i < e->technique_count; ++i)
2075 struct d3d10_effect_technique *t = &e->techniques[i];
2077 t->ID3D10EffectTechnique_iface.lpVtbl = &d3d10_effect_technique_vtbl;
2078 t->effect = e;
2080 hr = parse_fx10_technique(t, &ptr, data);
2081 if (FAILED(hr)) return hr;
2084 return S_OK;
2087 static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, DWORD data_size)
2089 const char *ptr = data;
2090 DWORD unknown;
2092 /* Compiled target version (e.g. fx_4_0=0xfeff1001, fx_4_1=0xfeff1011). */
2093 read_dword(&ptr, &e->version);
2094 TRACE("Target: %#x\n", e->version);
2096 read_dword(&ptr, &e->local_buffer_count);
2097 TRACE("Local buffer count: %u.\n", e->local_buffer_count);
2099 read_dword(&ptr, &e->variable_count);
2100 TRACE("Variable count: %u\n", e->variable_count);
2102 read_dword(&ptr, &e->local_variable_count);
2103 TRACE("Object count: %u\n", e->local_variable_count);
2105 read_dword(&ptr, &e->sharedbuffers_count);
2106 TRACE("Sharedbuffers count: %u\n", e->sharedbuffers_count);
2108 /* Number of variables in shared buffers? */
2109 read_dword(&ptr, &unknown);
2110 FIXME("Unknown 0: %u\n", unknown);
2112 read_dword(&ptr, &e->sharedobjects_count);
2113 TRACE("Sharedobjects count: %u\n", e->sharedobjects_count);
2115 read_dword(&ptr, &e->technique_count);
2116 TRACE("Technique count: %u\n", e->technique_count);
2118 read_dword(&ptr, &e->index_offset);
2119 TRACE("Index offset: %#x\n", e->index_offset);
2121 read_dword(&ptr, &unknown);
2122 FIXME("Unknown 1: %u\n", unknown);
2124 read_dword(&ptr, &e->texture_count);
2125 TRACE("Texture count: %u\n", e->texture_count);
2127 read_dword(&ptr, &e->dephstencilstate_count);
2128 TRACE("Depthstencilstate count: %u\n", e->dephstencilstate_count);
2130 read_dword(&ptr, &e->blendstate_count);
2131 TRACE("Blendstate count: %u\n", e->blendstate_count);
2133 read_dword(&ptr, &e->rasterizerstate_count);
2134 TRACE("Rasterizerstate count: %u\n", e->rasterizerstate_count);
2136 read_dword(&ptr, &e->samplerstate_count);
2137 TRACE("Samplerstate count: %u\n", e->samplerstate_count);
2139 read_dword(&ptr, &e->rendertargetview_count);
2140 TRACE("Rendertargetview count: %u\n", e->rendertargetview_count);
2142 read_dword(&ptr, &e->depthstencilview_count);
2143 TRACE("Depthstencilview count: %u\n", e->depthstencilview_count);
2145 read_dword(&ptr, &e->used_shader_count);
2146 TRACE("Used shader count: %u\n", e->used_shader_count);
2148 read_dword(&ptr, &e->anonymous_shader_count);
2149 TRACE("Anonymous shader count: %u\n", e->anonymous_shader_count);
2151 return parse_fx10_body(e, ptr, data_size - (ptr - data));
2154 static HRESULT fx10_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
2156 struct d3d10_effect *e = ctx;
2158 TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
2160 TRACE("chunk size: %#x\n", data_size);
2162 switch(tag)
2164 case TAG_FX10:
2165 return parse_fx10(e, data, data_size);
2167 default:
2168 FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4));
2169 return S_OK;
2173 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size)
2175 return parse_dxbc(data, data_size, fx10_chunk_handler, This);
2178 static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
2180 ID3D10Device *device = o->pass->technique->effect->device;
2182 TRACE("effect object %p, type %#x.\n", o, o->type);
2184 switch(o->type)
2186 case D3D10_EOT_RASTERIZER_STATE:
2187 ID3D10Device_RSSetState(device, o->object.rs);
2188 return S_OK;
2190 case D3D10_EOT_DEPTH_STENCIL_STATE:
2191 ID3D10Device_OMSetDepthStencilState(device, o->object.ds, o->pass->stencil_ref);
2192 return S_OK;
2194 case D3D10_EOT_BLEND_STATE:
2195 ID3D10Device_OMSetBlendState(device, o->object.bs, o->pass->blend_factor, o->pass->sample_mask);
2196 return S_OK;
2198 case D3D10_EOT_VERTEXSHADER:
2199 ID3D10Device_VSSetShader(device, o->object.vs);
2200 return S_OK;
2202 case D3D10_EOT_PIXELSHADER:
2203 ID3D10Device_PSSetShader(device, o->object.ps);
2204 return S_OK;
2206 case D3D10_EOT_GEOMETRYSHADER:
2207 ID3D10Device_GSSetShader(device, o->object.gs);
2208 return S_OK;
2210 case D3D10_EOT_STENCIL_REF:
2211 case D3D10_EOT_BLEND_FACTOR:
2212 case D3D10_EOT_SAMPLE_MASK:
2213 return S_OK;
2215 default:
2216 FIXME("Unhandled effect object type %#x.\n", o->type);
2217 return E_FAIL;
2221 static void d3d10_effect_shader_variable_destroy(struct d3d10_effect_shader_variable *s,
2222 D3D10_SHADER_VARIABLE_TYPE type)
2224 shader_free_signature(&s->input_signature);
2225 shader_free_signature(&s->output_signature);
2227 switch (type)
2229 case D3D10_SVT_VERTEXSHADER:
2230 if (s->shader.vs)
2231 ID3D10VertexShader_Release(s->shader.vs);
2232 break;
2234 case D3D10_SVT_PIXELSHADER:
2235 if (s->shader.ps)
2236 ID3D10PixelShader_Release(s->shader.ps);
2237 break;
2239 case D3D10_SVT_GEOMETRYSHADER:
2240 if (s->shader.gs)
2241 ID3D10GeometryShader_Release(s->shader.gs);
2242 break;
2244 default:
2245 FIXME("Unhandled shader type %s.\n", debug_d3d10_shader_variable_type(type));
2246 break;
2250 static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
2252 unsigned int i;
2254 TRACE("variable %p.\n", v);
2256 HeapFree(GetProcessHeap(), 0, v->name);
2257 HeapFree(GetProcessHeap(), 0, v->semantic);
2258 if (v->annotations)
2260 for (i = 0; i < v->annotation_count; ++i)
2262 d3d10_effect_variable_destroy(&v->annotations[i]);
2264 HeapFree(GetProcessHeap(), 0, v->annotations);
2267 if (v->members)
2269 for (i = 0; i < v->type->member_count; ++i)
2271 d3d10_effect_variable_destroy(&v->members[i]);
2273 HeapFree(GetProcessHeap(), 0, v->members);
2276 if (v->elements)
2278 for (i = 0; i < v->type->element_count; ++i)
2280 d3d10_effect_variable_destroy(&v->elements[i]);
2282 HeapFree(GetProcessHeap(), 0, v->elements);
2285 switch(v->type->basetype)
2287 case D3D10_SVT_VERTEXSHADER:
2288 case D3D10_SVT_PIXELSHADER:
2289 case D3D10_SVT_GEOMETRYSHADER:
2290 d3d10_effect_shader_variable_destroy(&v->u.shader, v->type->basetype);
2291 break;
2293 default:
2294 break;
2298 static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
2300 switch (o->type)
2302 case D3D10_EOT_RASTERIZER_STATE:
2303 if (o->object.rs)
2304 ID3D10RasterizerState_Release(o->object.rs);
2305 break;
2307 case D3D10_EOT_DEPTH_STENCIL_STATE:
2308 if (o->object.ds)
2309 ID3D10DepthStencilState_Release(o->object.ds);
2310 break;
2312 case D3D10_EOT_BLEND_STATE:
2313 if (o->object.bs)
2314 ID3D10BlendState_Release(o->object.bs);
2315 break;
2317 case D3D10_EOT_VERTEXSHADER:
2318 if (o->object.vs)
2319 ID3D10VertexShader_Release(o->object.vs);
2320 break;
2322 case D3D10_EOT_PIXELSHADER:
2323 if (o->object.ps)
2324 ID3D10PixelShader_Release(o->object.ps);
2325 break;
2327 case D3D10_EOT_GEOMETRYSHADER:
2328 if (o->object.gs)
2329 ID3D10GeometryShader_Release(o->object.gs);
2330 break;
2332 default:
2333 break;
2337 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
2339 unsigned int i;
2341 TRACE("pass %p\n", p);
2343 HeapFree(GetProcessHeap(), 0, p->name);
2345 if (p->objects)
2347 for (i = 0; i < p->object_count; ++i)
2349 d3d10_effect_object_destroy(&p->objects[i]);
2351 HeapFree(GetProcessHeap(), 0, p->objects);
2354 if (p->annotations)
2356 for (i = 0; i < p->annotation_count; ++i)
2358 d3d10_effect_variable_destroy(&p->annotations[i]);
2360 HeapFree(GetProcessHeap(), 0, p->annotations);
2364 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
2366 unsigned int i;
2368 TRACE("technique %p\n", t);
2370 HeapFree(GetProcessHeap(), 0, t->name);
2371 if (t->passes)
2373 for (i = 0; i < t->pass_count; ++i)
2375 d3d10_effect_pass_destroy(&t->passes[i]);
2377 HeapFree(GetProcessHeap(), 0, t->passes);
2380 if (t->annotations)
2382 for (i = 0; i < t->annotation_count; ++i)
2384 d3d10_effect_variable_destroy(&t->annotations[i]);
2386 HeapFree(GetProcessHeap(), 0, t->annotations);
2390 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
2392 unsigned int i;
2394 TRACE("local buffer %p.\n", l);
2396 HeapFree(GetProcessHeap(), 0, l->name);
2397 if (l->members)
2399 for (i = 0; i < l->type->member_count; ++i)
2401 d3d10_effect_variable_destroy(&l->members[i]);
2403 HeapFree(GetProcessHeap(), 0, l->members);
2406 if (l->type->members)
2408 for (i = 0; i < l->type->member_count; ++i)
2410 /* Do not release l->type->members[i].type, it will be covered by d3d10_effect_type_destroy(). */
2411 HeapFree(GetProcessHeap(), 0, l->type->members[i].semantic);
2412 HeapFree(GetProcessHeap(), 0, l->type->members[i].name);
2414 HeapFree(GetProcessHeap(), 0, l->type->members);
2416 HeapFree(GetProcessHeap(), 0, l->type->name);
2417 HeapFree(GetProcessHeap(), 0, l->type);
2419 if (l->annotations)
2421 for (i = 0; i < l->annotation_count; ++i)
2423 d3d10_effect_variable_destroy(&l->annotations[i]);
2425 HeapFree(GetProcessHeap(), 0, l->annotations);
2429 /* IUnknown methods */
2431 static inline struct d3d10_effect *impl_from_ID3D10Effect(ID3D10Effect *iface)
2433 return CONTAINING_RECORD(iface, struct d3d10_effect, ID3D10Effect_iface);
2436 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
2438 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
2440 if (IsEqualGUID(riid, &IID_ID3D10Effect)
2441 || IsEqualGUID(riid, &IID_IUnknown))
2443 IUnknown_AddRef(iface);
2444 *object = iface;
2445 return S_OK;
2448 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
2450 *object = NULL;
2451 return E_NOINTERFACE;
2454 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
2456 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2457 ULONG refcount = InterlockedIncrement(&This->refcount);
2459 TRACE("%p increasing refcount to %u\n", This, refcount);
2461 return refcount;
2464 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
2466 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2467 ULONG refcount = InterlockedDecrement(&This->refcount);
2469 TRACE("%p decreasing refcount to %u\n", This, refcount);
2471 if (!refcount)
2473 unsigned int i;
2475 if (This->techniques)
2477 for (i = 0; i < This->technique_count; ++i)
2479 d3d10_effect_technique_destroy(&This->techniques[i]);
2481 HeapFree(GetProcessHeap(), 0, This->techniques);
2484 if (This->local_variables)
2486 for (i = 0; i < This->local_variable_count; ++i)
2488 d3d10_effect_variable_destroy(&This->local_variables[i]);
2490 HeapFree(GetProcessHeap(), 0, This->local_variables);
2493 if (This->local_buffers)
2495 for (i = 0; i < This->local_buffer_count; ++i)
2497 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
2499 HeapFree(GetProcessHeap(), 0, This->local_buffers);
2502 if (This->anonymous_shaders)
2504 for (i = 0; i < This->anonymous_shader_count; ++i)
2506 d3d10_effect_variable_destroy(&This->anonymous_shaders[i].shader);
2507 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders[i].type.name);
2509 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders);
2512 HeapFree(GetProcessHeap(), 0, This->used_shaders);
2514 wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
2516 ID3D10Device_Release(This->device);
2517 HeapFree(GetProcessHeap(), 0, This);
2520 return refcount;
2523 /* ID3D10Effect methods */
2525 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
2527 FIXME("iface %p stub!\n", iface);
2529 return FALSE;
2532 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
2534 FIXME("iface %p stub!\n", iface);
2536 return FALSE;
2539 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
2541 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2543 TRACE("iface %p, device %p\n", iface, device);
2545 ID3D10Device_AddRef(This->device);
2546 *device = This->device;
2548 return S_OK;
2551 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
2553 FIXME("iface %p, desc %p stub!\n", iface, desc);
2555 return E_NOTIMPL;
2558 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
2559 UINT index)
2561 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2562 struct d3d10_effect_variable *l;
2564 TRACE("iface %p, index %u\n", iface, index);
2566 if (index >= This->local_buffer_count)
2568 WARN("Invalid index specified\n");
2569 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2572 l = &This->local_buffers[index];
2574 TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
2576 return (ID3D10EffectConstantBuffer *)l;
2579 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
2580 LPCSTR name)
2582 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2583 unsigned int i;
2585 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2587 for (i = 0; i < This->local_buffer_count; ++i)
2589 struct d3d10_effect_variable *l = &This->local_buffers[i];
2591 if (!strcmp(l->name, name))
2593 TRACE("Returning buffer %p.\n", l);
2594 return (ID3D10EffectConstantBuffer *)l;
2598 WARN("Invalid name specified\n");
2600 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2603 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
2605 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2606 unsigned int i;
2608 TRACE("iface %p, index %u\n", iface, index);
2610 for (i = 0; i < This->local_buffer_count; ++i)
2612 struct d3d10_effect_variable *l = &This->local_buffers[i];
2614 if (index < l->type->member_count)
2616 struct d3d10_effect_variable *v = &l->members[index];
2618 TRACE("Returning variable %p.\n", v);
2619 return &v->ID3D10EffectVariable_iface;
2621 index -= l->type->member_count;
2624 if (index < This->local_variable_count)
2626 struct d3d10_effect_variable *v = &This->local_variables[index];
2628 TRACE("Returning variable %p.\n", v);
2629 return &v->ID3D10EffectVariable_iface;
2632 WARN("Invalid index specified\n");
2634 return &null_variable.ID3D10EffectVariable_iface;
2637 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface, LPCSTR name)
2639 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2640 unsigned int i;
2642 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2644 if (!name)
2646 WARN("Invalid name specified\n");
2647 return &null_variable.ID3D10EffectVariable_iface;
2650 for (i = 0; i < This->local_buffer_count; ++i)
2652 struct d3d10_effect_variable *l = &This->local_buffers[i];
2653 unsigned int j;
2655 for (j = 0; j < l->type->member_count; ++j)
2657 struct d3d10_effect_variable *v = &l->members[j];
2659 if (!strcmp(v->name, name))
2661 TRACE("Returning variable %p.\n", v);
2662 return &v->ID3D10EffectVariable_iface;
2667 for (i = 0; i < This->local_variable_count; ++i)
2669 struct d3d10_effect_variable *v = &This->local_variables[i];
2671 if (!strcmp(v->name, name))
2673 TRACE("Returning variable %p.\n", v);
2674 return &v->ID3D10EffectVariable_iface;
2678 WARN("Invalid name specified\n");
2680 return &null_variable.ID3D10EffectVariable_iface;
2683 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
2684 LPCSTR semantic)
2686 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2687 unsigned int i;
2689 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
2691 if (!semantic)
2693 WARN("Invalid semantic specified\n");
2694 return &null_variable.ID3D10EffectVariable_iface;
2697 for (i = 0; i < This->local_buffer_count; ++i)
2699 struct d3d10_effect_variable *l = &This->local_buffers[i];
2700 unsigned int j;
2702 for (j = 0; j < l->type->member_count; ++j)
2704 struct d3d10_effect_variable *v = &l->members[j];
2706 if (!strcmp(v->semantic, semantic))
2708 TRACE("Returning variable %p.\n", v);
2709 return &v->ID3D10EffectVariable_iface;
2714 for (i = 0; i < This->local_variable_count; ++i)
2716 struct d3d10_effect_variable *v = &This->local_variables[i];
2718 if (!strcmp(v->semantic, semantic))
2720 TRACE("Returning variable %p.\n", v);
2721 return &v->ID3D10EffectVariable_iface;
2725 WARN("Invalid semantic specified\n");
2727 return &null_variable.ID3D10EffectVariable_iface;
2730 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
2731 UINT index)
2733 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2734 struct d3d10_effect_technique *t;
2736 TRACE("iface %p, index %u\n", iface, index);
2738 if (index >= This->technique_count)
2740 WARN("Invalid index specified\n");
2741 return &null_technique.ID3D10EffectTechnique_iface;
2744 t = &This->techniques[index];
2746 TRACE("Returning technique %p, %s.\n", t, debugstr_a(t->name));
2748 return &t->ID3D10EffectTechnique_iface;
2751 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
2752 LPCSTR name)
2754 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2755 unsigned int i;
2757 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2759 if (!name)
2761 WARN("Invalid name specified\n");
2762 return &null_technique.ID3D10EffectTechnique_iface;
2765 for (i = 0; i < This->technique_count; ++i)
2767 struct d3d10_effect_technique *t = &This->techniques[i];
2768 if (!strcmp(t->name, name))
2770 TRACE("Returning technique %p\n", t);
2771 return &t->ID3D10EffectTechnique_iface;
2775 WARN("Invalid name specified\n");
2777 return &null_technique.ID3D10EffectTechnique_iface;
2780 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
2782 FIXME("iface %p stub!\n", iface);
2784 return E_NOTIMPL;
2787 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
2789 FIXME("iface %p stub!\n", iface);
2791 return FALSE;
2794 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
2796 /* IUnknown methods */
2797 d3d10_effect_QueryInterface,
2798 d3d10_effect_AddRef,
2799 d3d10_effect_Release,
2800 /* ID3D10Effect methods */
2801 d3d10_effect_IsValid,
2802 d3d10_effect_IsPool,
2803 d3d10_effect_GetDevice,
2804 d3d10_effect_GetDesc,
2805 d3d10_effect_GetConstantBufferByIndex,
2806 d3d10_effect_GetConstantBufferByName,
2807 d3d10_effect_GetVariableByIndex,
2808 d3d10_effect_GetVariableByName,
2809 d3d10_effect_GetVariableBySemantic,
2810 d3d10_effect_GetTechniqueByIndex,
2811 d3d10_effect_GetTechniqueByName,
2812 d3d10_effect_Optimize,
2813 d3d10_effect_IsOptimized,
2816 /* ID3D10EffectTechnique methods */
2818 static inline struct d3d10_effect_technique *impl_from_ID3D10EffectTechnique(ID3D10EffectTechnique *iface)
2820 return CONTAINING_RECORD(iface, struct d3d10_effect_technique, ID3D10EffectTechnique_iface);
2823 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
2825 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2827 TRACE("iface %p\n", iface);
2829 return This != &null_technique;
2832 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
2833 D3D10_TECHNIQUE_DESC *desc)
2835 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2837 TRACE("iface %p, desc %p\n", iface, desc);
2839 if(This == &null_technique)
2841 WARN("Null technique specified\n");
2842 return E_FAIL;
2845 if(!desc)
2847 WARN("Invalid argument specified\n");
2848 return E_INVALIDARG;
2851 desc->Name = This->name;
2852 desc->Passes = This->pass_count;
2853 desc->Annotations = This->annotation_count;
2855 return S_OK;
2858 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
2859 ID3D10EffectTechnique *iface, UINT index)
2861 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2862 struct d3d10_effect_variable *a;
2864 TRACE("iface %p, index %u\n", iface, index);
2866 if (index >= This->annotation_count)
2868 WARN("Invalid index specified\n");
2869 return &null_variable.ID3D10EffectVariable_iface;
2872 a = &This->annotations[index];
2874 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2876 return &a->ID3D10EffectVariable_iface;
2879 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
2880 ID3D10EffectTechnique *iface, LPCSTR name)
2882 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2883 unsigned int i;
2885 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2887 for (i = 0; i < This->annotation_count; ++i)
2889 struct d3d10_effect_variable *a = &This->annotations[i];
2890 if (!strcmp(a->name, name))
2892 TRACE("Returning annotation %p\n", a);
2893 return &a->ID3D10EffectVariable_iface;
2897 WARN("Invalid name specified\n");
2899 return &null_variable.ID3D10EffectVariable_iface;
2902 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
2903 UINT index)
2905 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2906 struct d3d10_effect_pass *p;
2908 TRACE("iface %p, index %u\n", iface, index);
2910 if (index >= This->pass_count)
2912 WARN("Invalid index specified\n");
2913 return &null_pass.ID3D10EffectPass_iface;
2916 p = &This->passes[index];
2918 TRACE("Returning pass %p, %s.\n", p, debugstr_a(p->name));
2920 return &p->ID3D10EffectPass_iface;
2923 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
2924 LPCSTR name)
2926 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2927 unsigned int i;
2929 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2931 /* Do not check for name==NULL, W7/DX10 crashes in that case. */
2933 for (i = 0; i < This->pass_count; ++i)
2935 struct d3d10_effect_pass *p = &This->passes[i];
2936 if (!strcmp(p->name, name))
2938 TRACE("Returning pass %p\n", p);
2939 return &p->ID3D10EffectPass_iface;
2943 WARN("Invalid name specified\n");
2945 return &null_pass.ID3D10EffectPass_iface;
2948 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
2949 D3D10_STATE_BLOCK_MASK *mask)
2951 FIXME("iface %p,mask %p stub!\n", iface, mask);
2953 return E_NOTIMPL;
2956 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
2958 /* ID3D10EffectTechnique methods */
2959 d3d10_effect_technique_IsValid,
2960 d3d10_effect_technique_GetDesc,
2961 d3d10_effect_technique_GetAnnotationByIndex,
2962 d3d10_effect_technique_GetAnnotationByName,
2963 d3d10_effect_technique_GetPassByIndex,
2964 d3d10_effect_technique_GetPassByName,
2965 d3d10_effect_technique_ComputeStateBlockMask,
2968 /* ID3D10EffectPass methods */
2970 static inline struct d3d10_effect_pass *impl_from_ID3D10EffectPass(ID3D10EffectPass *iface)
2972 return CONTAINING_RECORD(iface, struct d3d10_effect_pass, ID3D10EffectPass_iface);
2975 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
2977 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2979 TRACE("iface %p\n", iface);
2981 return This != &null_pass;
2984 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface,
2985 D3D10_PASS_DESC *desc)
2987 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
2988 struct d3d10_effect_shader_variable *s;
2990 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
2992 if(This == &null_pass)
2994 WARN("Null pass specified\n");
2995 return E_FAIL;
2998 if(!desc)
3000 WARN("Invalid argument specified\n");
3001 return E_INVALIDARG;
3004 memset(desc, 0, sizeof(*desc));
3005 desc->Name = This->name;
3007 s = &impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)This->vs.pShaderVariable)->u.shader;
3008 desc->pIAInputSignature = (BYTE *)s->input_signature.signature;
3009 desc->IAInputSignatureSize = s->input_signature.signature_size;
3011 desc->StencilRef = This->stencil_ref;
3012 desc->SampleMask = This->sample_mask;
3013 memcpy(desc->BlendFactor, This->blend_factor, 4 * sizeof(float));
3015 return S_OK;
3018 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
3019 D3D10_PASS_SHADER_DESC *desc)
3021 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3023 TRACE("iface %p, desc %p\n", iface, desc);
3025 if (This == &null_pass)
3027 WARN("Null pass specified\n");
3028 return E_FAIL;
3031 if (!desc)
3033 WARN("Invalid argument specified\n");
3034 return E_INVALIDARG;
3037 *desc = This->vs;
3039 return S_OK;
3042 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
3043 D3D10_PASS_SHADER_DESC *desc)
3045 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3047 TRACE("iface %p, desc %p\n", iface, desc);
3049 if (This == &null_pass)
3051 WARN("Null pass specified\n");
3052 return E_FAIL;
3055 if (!desc)
3057 WARN("Invalid argument specified\n");
3058 return E_INVALIDARG;
3061 *desc = This->gs;
3063 return S_OK;
3066 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
3067 D3D10_PASS_SHADER_DESC *desc)
3069 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3071 TRACE("iface %p, desc %p\n", iface, desc);
3073 if (This == &null_pass)
3075 WARN("Null pass specified\n");
3076 return E_FAIL;
3079 if (!desc)
3081 WARN("Invalid argument specified\n");
3082 return E_INVALIDARG;
3085 *desc = This->ps;
3087 return S_OK;
3090 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
3091 UINT index)
3093 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3094 struct d3d10_effect_variable *a;
3096 TRACE("iface %p, index %u\n", iface, index);
3098 if (index >= This->annotation_count)
3100 WARN("Invalid index specified\n");
3101 return &null_variable.ID3D10EffectVariable_iface;
3104 a = &This->annotations[index];
3106 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3108 return &a->ID3D10EffectVariable_iface;
3111 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
3112 LPCSTR name)
3114 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3115 unsigned int i;
3117 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3119 for (i = 0; i < This->annotation_count; ++i)
3121 struct d3d10_effect_variable *a = &This->annotations[i];
3122 if (!strcmp(a->name, name))
3124 TRACE("Returning annotation %p\n", a);
3125 return &a->ID3D10EffectVariable_iface;
3129 WARN("Invalid name specified\n");
3131 return &null_variable.ID3D10EffectVariable_iface;
3134 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
3136 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3137 HRESULT hr = S_OK;
3138 unsigned int i;
3140 TRACE("iface %p, flags %#x\n", iface, flags);
3142 if (flags) FIXME("Ignoring flags (%#x)\n", flags);
3144 for (i = 0; i < This->object_count; ++i)
3146 hr = d3d10_effect_object_apply(&This->objects[i]);
3147 if (FAILED(hr)) break;
3150 return hr;
3153 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
3154 D3D10_STATE_BLOCK_MASK *mask)
3156 FIXME("iface %p, mask %p stub!\n", iface, mask);
3158 return E_NOTIMPL;
3161 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
3163 /* ID3D10EffectPass methods */
3164 d3d10_effect_pass_IsValid,
3165 d3d10_effect_pass_GetDesc,
3166 d3d10_effect_pass_GetVertexShaderDesc,
3167 d3d10_effect_pass_GetGeometryShaderDesc,
3168 d3d10_effect_pass_GetPixelShaderDesc,
3169 d3d10_effect_pass_GetAnnotationByIndex,
3170 d3d10_effect_pass_GetAnnotationByName,
3171 d3d10_effect_pass_Apply,
3172 d3d10_effect_pass_ComputeStateBlockMask,
3175 /* ID3D10EffectVariable methods */
3177 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
3179 TRACE("iface %p\n", iface);
3181 return impl_from_ID3D10EffectVariable(iface) != &null_variable;
3184 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
3186 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3188 TRACE("iface %p\n", iface);
3190 return &This->type->ID3D10EffectType_iface;
3193 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
3194 D3D10_EFFECT_VARIABLE_DESC *desc)
3196 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3198 TRACE("iface %p, desc %p\n", iface, desc);
3200 if (!iface->lpVtbl->IsValid(iface))
3202 WARN("Null variable specified\n");
3203 return E_FAIL;
3206 if (!desc)
3208 WARN("Invalid argument specified\n");
3209 return E_INVALIDARG;
3212 /* FIXME: This isn't correct. Anonymous shaders let desc->ExplicitBindPoint untouched, but normal shaders set it! */
3213 memset(desc, 0, sizeof(*desc));
3214 desc->Name = This->name;
3215 desc->Semantic = This->semantic;
3216 desc->Flags = This->flag;
3217 desc->Annotations = This->annotation_count;
3218 desc->BufferOffset = This->buffer_offset;
3220 if (This->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
3222 desc->ExplicitBindPoint = This->buffer_offset;
3225 return S_OK;
3228 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
3229 ID3D10EffectVariable *iface, UINT index)
3231 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3232 struct d3d10_effect_variable *a;
3234 TRACE("iface %p, index %u\n", iface, index);
3236 if (index >= This->annotation_count)
3238 WARN("Invalid index specified\n");
3239 return &null_variable.ID3D10EffectVariable_iface;
3242 a = &This->annotations[index];
3244 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3246 return &a->ID3D10EffectVariable_iface;
3249 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
3250 ID3D10EffectVariable *iface, LPCSTR name)
3252 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3253 unsigned int i;
3255 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3257 for (i = 0; i < This->annotation_count; ++i)
3259 struct d3d10_effect_variable *a = &This->annotations[i];
3260 if (!strcmp(a->name, name))
3262 TRACE("Returning annotation %p\n", a);
3263 return &a->ID3D10EffectVariable_iface;
3267 WARN("Invalid name specified\n");
3269 return &null_variable.ID3D10EffectVariable_iface;
3272 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
3273 ID3D10EffectVariable *iface, UINT index)
3275 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3276 struct d3d10_effect_variable *m;
3278 TRACE("iface %p, index %u\n", iface, index);
3280 if (index >= This->type->member_count)
3282 WARN("Invalid index specified\n");
3283 return &null_variable.ID3D10EffectVariable_iface;
3286 m = &This->members[index];
3288 TRACE("Returning member %p, %s\n", m, debugstr_a(m->name));
3290 return &m->ID3D10EffectVariable_iface;
3293 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
3294 ID3D10EffectVariable *iface, LPCSTR name)
3296 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3297 unsigned int i;
3299 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3301 if (!name)
3303 WARN("Invalid name specified\n");
3304 return &null_variable.ID3D10EffectVariable_iface;
3307 for (i = 0; i < This->type->member_count; ++i)
3309 struct d3d10_effect_variable *m = &This->members[i];
3311 if (m->name)
3313 if (!strcmp(m->name, name))
3315 TRACE("Returning member %p\n", m);
3316 return &m->ID3D10EffectVariable_iface;
3321 WARN("Invalid name specified\n");
3323 return &null_variable.ID3D10EffectVariable_iface;
3326 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
3327 ID3D10EffectVariable *iface, LPCSTR semantic)
3329 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3330 unsigned int i;
3332 TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic));
3334 if (!semantic)
3336 WARN("Invalid semantic specified\n");
3337 return &null_variable.ID3D10EffectVariable_iface;
3340 for (i = 0; i < This->type->member_count; ++i)
3342 struct d3d10_effect_variable *m = &This->members[i];
3344 if (m->semantic)
3346 if (!strcmp(m->semantic, semantic))
3348 TRACE("Returning member %p\n", m);
3349 return &m->ID3D10EffectVariable_iface;
3354 WARN("Invalid semantic specified\n");
3356 return &null_variable.ID3D10EffectVariable_iface;
3359 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
3360 ID3D10EffectVariable *iface, UINT index)
3362 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3363 struct d3d10_effect_variable *v;
3365 TRACE("iface %p, index %u\n", iface, index);
3367 if (index >= This->type->element_count)
3369 WARN("Invalid index specified\n");
3370 return &null_variable.ID3D10EffectVariable_iface;
3373 v = &This->elements[index];
3375 TRACE("Returning element %p, %s\n", v, debugstr_a(v->name));
3377 return &v->ID3D10EffectVariable_iface;
3380 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
3381 ID3D10EffectVariable *iface)
3383 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3385 TRACE("iface %p\n", iface);
3387 return (ID3D10EffectConstantBuffer *)This->buffer;
3390 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
3391 ID3D10EffectVariable *iface)
3393 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3395 TRACE("iface %p\n", iface);
3397 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
3398 return (ID3D10EffectScalarVariable *)&This->ID3D10EffectVariable_iface;
3400 return (ID3D10EffectScalarVariable *)&null_scalar_variable.ID3D10EffectVariable_iface;
3403 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
3404 ID3D10EffectVariable *iface)
3406 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3408 TRACE("iface %p\n", iface);
3410 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl)
3411 return (ID3D10EffectVectorVariable *)&This->ID3D10EffectVariable_iface;
3413 return (ID3D10EffectVectorVariable *)&null_vector_variable.ID3D10EffectVariable_iface;
3416 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
3417 ID3D10EffectVariable *iface)
3419 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3421 TRACE("iface %p\n", iface);
3423 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl)
3424 return (ID3D10EffectMatrixVariable *)&This->ID3D10EffectVariable_iface;
3426 return (ID3D10EffectMatrixVariable *)&null_matrix_variable.ID3D10EffectVariable_iface;
3429 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
3430 ID3D10EffectVariable *iface)
3432 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3434 TRACE("iface %p\n", iface);
3436 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl)
3437 return (ID3D10EffectStringVariable *)&This->ID3D10EffectVariable_iface;
3439 return (ID3D10EffectStringVariable *)&null_string_variable.ID3D10EffectVariable_iface;
3442 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
3443 ID3D10EffectVariable *iface)
3445 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3447 TRACE("iface %p\n", iface);
3449 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl)
3450 return (ID3D10EffectShaderResourceVariable *)&This->ID3D10EffectVariable_iface;
3452 return (ID3D10EffectShaderResourceVariable *)&null_shader_resource_variable.ID3D10EffectVariable_iface;
3455 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
3456 ID3D10EffectVariable *iface)
3458 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3460 TRACE("iface %p\n", iface);
3462 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl)
3463 return (ID3D10EffectRenderTargetViewVariable *)&This->ID3D10EffectVariable_iface;
3465 return (ID3D10EffectRenderTargetViewVariable *)&null_render_target_view_variable.ID3D10EffectVariable_iface;
3468 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
3469 ID3D10EffectVariable *iface)
3471 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3473 TRACE("iface %p\n", iface);
3475 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl)
3476 return (ID3D10EffectDepthStencilViewVariable *)&This->ID3D10EffectVariable_iface;
3478 return (ID3D10EffectDepthStencilViewVariable *)&null_depth_stencil_view_variable.ID3D10EffectVariable_iface;
3481 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
3482 ID3D10EffectVariable *iface)
3484 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3486 TRACE("iface %p\n", iface);
3488 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl)
3489 return (ID3D10EffectConstantBuffer *)&This->ID3D10EffectVariable_iface;
3491 return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface;
3494 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
3495 ID3D10EffectVariable *iface)
3497 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3499 TRACE("iface %p\n", iface);
3501 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl)
3502 return (ID3D10EffectShaderVariable *)&This->ID3D10EffectVariable_iface;
3504 return (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
3507 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
3509 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3511 TRACE("iface %p\n", iface);
3513 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl)
3514 return (ID3D10EffectBlendVariable *)&This->ID3D10EffectVariable_iface;
3516 return (ID3D10EffectBlendVariable *)&null_blend_variable.ID3D10EffectVariable_iface;
3519 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
3520 ID3D10EffectVariable *iface)
3522 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3524 TRACE("iface %p\n", iface);
3526 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl)
3527 return (ID3D10EffectDepthStencilVariable *)&This->ID3D10EffectVariable_iface;
3529 return (ID3D10EffectDepthStencilVariable *)&null_depth_stencil_variable.ID3D10EffectVariable_iface;
3532 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
3533 ID3D10EffectVariable *iface)
3535 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3537 TRACE("iface %p\n", iface);
3539 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl)
3540 return (ID3D10EffectRasterizerVariable *)&This->ID3D10EffectVariable_iface;
3542 return (ID3D10EffectRasterizerVariable *)&null_rasterizer_variable.ID3D10EffectVariable_iface;
3545 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
3546 ID3D10EffectVariable *iface)
3548 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3550 TRACE("iface %p\n", iface);
3552 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl)
3553 return (ID3D10EffectSamplerVariable *)&This->ID3D10EffectVariable_iface;
3555 return (ID3D10EffectSamplerVariable *)&null_sampler_variable.ID3D10EffectVariable_iface;
3558 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
3559 void *data, UINT offset, UINT count)
3561 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3563 return E_NOTIMPL;
3566 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
3567 void *data, UINT offset, UINT count)
3569 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3571 return E_NOTIMPL;
3574 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
3576 /* ID3D10EffectVariable methods */
3577 d3d10_effect_variable_IsValid,
3578 d3d10_effect_variable_GetType,
3579 d3d10_effect_variable_GetDesc,
3580 d3d10_effect_variable_GetAnnotationByIndex,
3581 d3d10_effect_variable_GetAnnotationByName,
3582 d3d10_effect_variable_GetMemberByIndex,
3583 d3d10_effect_variable_GetMemberByName,
3584 d3d10_effect_variable_GetMemberBySemantic,
3585 d3d10_effect_variable_GetElement,
3586 d3d10_effect_variable_GetParentConstantBuffer,
3587 d3d10_effect_variable_AsScalar,
3588 d3d10_effect_variable_AsVector,
3589 d3d10_effect_variable_AsMatrix,
3590 d3d10_effect_variable_AsString,
3591 d3d10_effect_variable_AsShaderResource,
3592 d3d10_effect_variable_AsRenderTargetView,
3593 d3d10_effect_variable_AsDepthStencilView,
3594 d3d10_effect_variable_AsConstantBuffer,
3595 d3d10_effect_variable_AsShader,
3596 d3d10_effect_variable_AsBlend,
3597 d3d10_effect_variable_AsDepthStencil,
3598 d3d10_effect_variable_AsRasterizer,
3599 d3d10_effect_variable_AsSampler,
3600 d3d10_effect_variable_SetRawValue,
3601 d3d10_effect_variable_GetRawValue,
3604 /* ID3D10EffectVariable methods */
3605 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
3607 TRACE("iface %p\n", iface);
3609 return (struct d3d10_effect_variable *)iface != &null_local_buffer;
3612 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
3614 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3617 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
3618 D3D10_EFFECT_VARIABLE_DESC *desc)
3620 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3623 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
3624 ID3D10EffectConstantBuffer *iface, UINT index)
3626 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3629 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
3630 ID3D10EffectConstantBuffer *iface, LPCSTR name)
3632 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3635 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
3636 ID3D10EffectConstantBuffer *iface, UINT index)
3638 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3641 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
3642 ID3D10EffectConstantBuffer *iface, LPCSTR name)
3644 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3647 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
3648 ID3D10EffectConstantBuffer *iface, LPCSTR semantic)
3650 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3653 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
3654 ID3D10EffectConstantBuffer *iface, UINT index)
3656 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3659 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
3660 ID3D10EffectConstantBuffer *iface)
3662 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3665 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
3666 ID3D10EffectConstantBuffer *iface)
3668 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3671 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
3672 ID3D10EffectConstantBuffer *iface)
3674 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3677 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
3678 ID3D10EffectConstantBuffer *iface)
3680 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3683 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
3684 ID3D10EffectConstantBuffer *iface)
3686 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3689 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
3690 ID3D10EffectConstantBuffer *iface)
3692 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3695 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
3696 ID3D10EffectConstantBuffer *iface)
3698 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3701 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
3702 ID3D10EffectConstantBuffer *iface)
3704 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3707 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
3708 ID3D10EffectConstantBuffer *iface)
3710 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3713 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
3714 ID3D10EffectConstantBuffer *iface)
3716 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3719 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
3721 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3724 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
3725 ID3D10EffectConstantBuffer *iface)
3727 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3730 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
3731 ID3D10EffectConstantBuffer *iface)
3733 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3736 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
3737 ID3D10EffectConstantBuffer *iface)
3739 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3742 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
3743 void *data, UINT offset, UINT count)
3745 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3748 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
3749 void *data, UINT offset, UINT count)
3751 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3754 /* ID3D10EffectConstantBuffer methods */
3755 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3756 ID3D10Buffer *buffer)
3758 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3760 return E_NOTIMPL;
3763 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3764 ID3D10Buffer **buffer)
3766 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3768 return E_NOTIMPL;
3771 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3772 ID3D10ShaderResourceView *view)
3774 FIXME("iface %p, view %p stub!\n", iface, view);
3776 return E_NOTIMPL;
3779 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3780 ID3D10ShaderResourceView **view)
3782 FIXME("iface %p, view %p stub!\n", iface, view);
3784 return E_NOTIMPL;
3787 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
3789 /* ID3D10EffectVariable methods */
3790 d3d10_effect_constant_buffer_IsValid,
3791 d3d10_effect_constant_buffer_GetType,
3792 d3d10_effect_constant_buffer_GetDesc,
3793 d3d10_effect_constant_buffer_GetAnnotationByIndex,
3794 d3d10_effect_constant_buffer_GetAnnotationByName,
3795 d3d10_effect_constant_buffer_GetMemberByIndex,
3796 d3d10_effect_constant_buffer_GetMemberByName,
3797 d3d10_effect_constant_buffer_GetMemberBySemantic,
3798 d3d10_effect_constant_buffer_GetElement,
3799 d3d10_effect_constant_buffer_GetParentConstantBuffer,
3800 d3d10_effect_constant_buffer_AsScalar,
3801 d3d10_effect_constant_buffer_AsVector,
3802 d3d10_effect_constant_buffer_AsMatrix,
3803 d3d10_effect_constant_buffer_AsString,
3804 d3d10_effect_constant_buffer_AsShaderResource,
3805 d3d10_effect_constant_buffer_AsRenderTargetView,
3806 d3d10_effect_constant_buffer_AsDepthStencilView,
3807 d3d10_effect_constant_buffer_AsConstantBuffer,
3808 d3d10_effect_constant_buffer_AsShader,
3809 d3d10_effect_constant_buffer_AsBlend,
3810 d3d10_effect_constant_buffer_AsDepthStencil,
3811 d3d10_effect_constant_buffer_AsRasterizer,
3812 d3d10_effect_constant_buffer_AsSampler,
3813 d3d10_effect_constant_buffer_SetRawValue,
3814 d3d10_effect_constant_buffer_GetRawValue,
3815 /* ID3D10EffectConstantBuffer methods */
3816 d3d10_effect_constant_buffer_SetConstantBuffer,
3817 d3d10_effect_constant_buffer_GetConstantBuffer,
3818 d3d10_effect_constant_buffer_SetTextureBuffer,
3819 d3d10_effect_constant_buffer_GetTextureBuffer,
3822 /* ID3D10EffectVariable methods */
3824 static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
3826 TRACE("iface %p\n", iface);
3828 return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
3831 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
3832 ID3D10EffectScalarVariable *iface)
3834 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3837 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
3838 D3D10_EFFECT_VARIABLE_DESC *desc)
3840 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3843 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
3844 ID3D10EffectScalarVariable *iface, UINT index)
3846 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3849 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
3850 ID3D10EffectScalarVariable *iface, LPCSTR name)
3852 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3855 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
3856 ID3D10EffectScalarVariable *iface, UINT index)
3858 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3861 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
3862 ID3D10EffectScalarVariable *iface, LPCSTR name)
3864 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3867 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
3868 ID3D10EffectScalarVariable *iface, LPCSTR semantic)
3870 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3873 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
3874 ID3D10EffectScalarVariable *iface, UINT index)
3876 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3879 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
3880 ID3D10EffectScalarVariable *iface)
3882 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3885 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
3886 ID3D10EffectScalarVariable *iface)
3888 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3891 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
3892 ID3D10EffectScalarVariable *iface)
3894 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3897 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
3898 ID3D10EffectScalarVariable *iface)
3900 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3903 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
3904 ID3D10EffectScalarVariable *iface)
3906 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3909 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
3910 ID3D10EffectScalarVariable *iface)
3912 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3915 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
3916 ID3D10EffectScalarVariable *iface)
3918 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3921 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
3922 ID3D10EffectScalarVariable *iface)
3924 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3927 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
3928 ID3D10EffectScalarVariable *iface)
3930 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3933 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
3934 ID3D10EffectScalarVariable *iface)
3936 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3939 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
3940 ID3D10EffectScalarVariable *iface)
3942 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3945 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
3946 ID3D10EffectScalarVariable *iface)
3948 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3951 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
3952 ID3D10EffectScalarVariable *iface)
3954 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3957 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
3958 ID3D10EffectScalarVariable *iface)
3960 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3963 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
3964 void *data, UINT offset, UINT count)
3966 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3969 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
3970 void *data, UINT offset, UINT count)
3972 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3975 /* ID3D10EffectScalarVariable methods */
3977 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
3978 float value)
3980 FIXME("iface %p, value %.8e stub!\n", iface, value);
3982 return E_NOTIMPL;
3985 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
3986 float *value)
3988 FIXME("iface %p, value %p stub!\n", iface, value);
3990 return E_NOTIMPL;
3993 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
3994 float *values, UINT offset, UINT count)
3996 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
3998 return E_NOTIMPL;
4001 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
4002 float *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_SetInt(ID3D10EffectScalarVariable *iface,
4010 int value)
4012 FIXME("iface %p, value %d stub!\n", iface, value);
4014 return E_NOTIMPL;
4017 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
4018 int *value)
4020 FIXME("iface %p, value %p stub!\n", iface, value);
4022 return E_NOTIMPL;
4025 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
4026 int *values, UINT offset, UINT count)
4028 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4030 return E_NOTIMPL;
4033 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
4034 int *values, UINT offset, UINT count)
4036 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4038 return E_NOTIMPL;
4041 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
4042 BOOL value)
4044 FIXME("iface %p, value %d stub!\n", iface, value);
4046 return E_NOTIMPL;
4049 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
4050 BOOL *value)
4052 FIXME("iface %p, value %p stub!\n", iface, value);
4054 return E_NOTIMPL;
4057 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
4058 BOOL *values, UINT offset, UINT count)
4060 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4062 return E_NOTIMPL;
4065 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
4066 BOOL *values, UINT offset, UINT count)
4068 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4070 return E_NOTIMPL;
4073 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
4075 /* ID3D10EffectVariable methods */
4076 d3d10_effect_scalar_variable_IsValid,
4077 d3d10_effect_scalar_variable_GetType,
4078 d3d10_effect_scalar_variable_GetDesc,
4079 d3d10_effect_scalar_variable_GetAnnotationByIndex,
4080 d3d10_effect_scalar_variable_GetAnnotationByName,
4081 d3d10_effect_scalar_variable_GetMemberByIndex,
4082 d3d10_effect_scalar_variable_GetMemberByName,
4083 d3d10_effect_scalar_variable_GetMemberBySemantic,
4084 d3d10_effect_scalar_variable_GetElement,
4085 d3d10_effect_scalar_variable_GetParentConstantBuffer,
4086 d3d10_effect_scalar_variable_AsScalar,
4087 d3d10_effect_scalar_variable_AsVector,
4088 d3d10_effect_scalar_variable_AsMatrix,
4089 d3d10_effect_scalar_variable_AsString,
4090 d3d10_effect_scalar_variable_AsShaderResource,
4091 d3d10_effect_scalar_variable_AsRenderTargetView,
4092 d3d10_effect_scalar_variable_AsDepthStencilView,
4093 d3d10_effect_scalar_variable_AsConstantBuffer,
4094 d3d10_effect_scalar_variable_AsShader,
4095 d3d10_effect_scalar_variable_AsBlend,
4096 d3d10_effect_scalar_variable_AsDepthStencil,
4097 d3d10_effect_scalar_variable_AsRasterizer,
4098 d3d10_effect_scalar_variable_AsSampler,
4099 d3d10_effect_scalar_variable_SetRawValue,
4100 d3d10_effect_scalar_variable_GetRawValue,
4101 /* ID3D10EffectScalarVariable methods */
4102 d3d10_effect_scalar_variable_SetFloat,
4103 d3d10_effect_scalar_variable_GetFloat,
4104 d3d10_effect_scalar_variable_SetFloatArray,
4105 d3d10_effect_scalar_variable_GetFloatArray,
4106 d3d10_effect_scalar_variable_SetInt,
4107 d3d10_effect_scalar_variable_GetInt,
4108 d3d10_effect_scalar_variable_SetIntArray,
4109 d3d10_effect_scalar_variable_GetIntArray,
4110 d3d10_effect_scalar_variable_SetBool,
4111 d3d10_effect_scalar_variable_GetBool,
4112 d3d10_effect_scalar_variable_SetBoolArray,
4113 d3d10_effect_scalar_variable_GetBoolArray,
4116 /* ID3D10EffectVariable methods */
4118 static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
4120 TRACE("iface %p\n", iface);
4122 return (struct d3d10_effect_variable *)iface != &null_vector_variable;
4125 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetType(
4126 ID3D10EffectVectorVariable *iface)
4128 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4131 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetDesc(ID3D10EffectVectorVariable *iface,
4132 D3D10_EFFECT_VARIABLE_DESC *desc)
4134 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4137 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByIndex(
4138 ID3D10EffectVectorVariable *iface, UINT index)
4140 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4143 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByName(
4144 ID3D10EffectVectorVariable *iface, LPCSTR name)
4146 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4149 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByIndex(
4150 ID3D10EffectVectorVariable *iface, UINT index)
4152 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4155 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByName(
4156 ID3D10EffectVectorVariable *iface, LPCSTR name)
4158 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4161 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberBySemantic(
4162 ID3D10EffectVectorVariable *iface, LPCSTR semantic)
4164 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4167 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetElement(
4168 ID3D10EffectVectorVariable *iface, UINT index)
4170 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4173 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetParentConstantBuffer(
4174 ID3D10EffectVectorVariable *iface)
4176 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4179 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsScalar(
4180 ID3D10EffectVectorVariable *iface)
4182 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4185 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsVector(
4186 ID3D10EffectVectorVariable *iface)
4188 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4191 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsMatrix(
4192 ID3D10EffectVectorVariable *iface)
4194 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4197 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsString(
4198 ID3D10EffectVectorVariable *iface)
4200 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4203 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShaderResource(
4204 ID3D10EffectVectorVariable *iface)
4206 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4209 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRenderTargetView(
4210 ID3D10EffectVectorVariable *iface)
4212 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4215 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencilView(
4216 ID3D10EffectVectorVariable *iface)
4218 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4221 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsConstantBuffer(
4222 ID3D10EffectVectorVariable *iface)
4224 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4227 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShader(
4228 ID3D10EffectVectorVariable *iface)
4230 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4233 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsBlend(
4234 ID3D10EffectVectorVariable *iface)
4236 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4239 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencil(
4240 ID3D10EffectVectorVariable *iface)
4242 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4245 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRasterizer(
4246 ID3D10EffectVectorVariable *iface)
4248 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4251 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsSampler(
4252 ID3D10EffectVectorVariable *iface)
4254 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4257 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetRawValue(ID3D10EffectVectorVariable *iface,
4258 void *data, UINT offset, UINT count)
4260 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4263 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetRawValue(ID3D10EffectVectorVariable *iface,
4264 void *data, UINT offset, UINT count)
4266 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4269 /* ID3D10EffectVectorVariable methods */
4271 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVector(ID3D10EffectVectorVariable *iface,
4272 BOOL *value)
4274 FIXME("iface %p, value %p stub!\n", iface, value);
4276 return E_NOTIMPL;
4279 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVector(ID3D10EffectVectorVariable *iface,
4280 int *value)
4282 FIXME("iface %p, value %p stub!\n", iface, value);
4284 return E_NOTIMPL;
4287 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVector(ID3D10EffectVectorVariable *iface,
4288 float *value)
4290 FIXME("iface %p, value %p stub!\n", iface, value);
4292 return E_NOTIMPL;
4295 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVector(ID3D10EffectVectorVariable *iface,
4296 BOOL *value)
4298 FIXME("iface %p, value %p stub!\n", iface, value);
4300 return E_NOTIMPL;
4303 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVector(ID3D10EffectVectorVariable *iface,
4304 int *value)
4306 FIXME("iface %p, value %p stub!\n", iface, value);
4308 return E_NOTIMPL;
4311 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVector(ID3D10EffectVectorVariable *iface,
4312 float *value)
4314 FIXME("iface %p, value %p stub!\n", iface, value);
4316 return E_NOTIMPL;
4319 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4320 BOOL *values, UINT offset, UINT count)
4322 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4324 return E_NOTIMPL;
4327 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVectorArray(ID3D10EffectVectorVariable *iface,
4328 int *values, UINT offset, UINT count)
4330 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4332 return E_NOTIMPL;
4335 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4336 float *values, UINT offset, UINT count)
4338 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4340 return E_NOTIMPL;
4343 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4344 BOOL *values, UINT offset, UINT count)
4346 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4348 return E_NOTIMPL;
4351 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVectorArray(ID3D10EffectVectorVariable *iface,
4352 int *values, UINT offset, UINT count)
4354 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4356 return E_NOTIMPL;
4359 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4360 float *values, UINT offset, UINT count)
4362 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4364 return E_NOTIMPL;
4367 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl =
4369 /* ID3D10EffectVariable methods */
4370 d3d10_effect_vector_variable_IsValid,
4371 d3d10_effect_vector_variable_GetType,
4372 d3d10_effect_vector_variable_GetDesc,
4373 d3d10_effect_vector_variable_GetAnnotationByIndex,
4374 d3d10_effect_vector_variable_GetAnnotationByName,
4375 d3d10_effect_vector_variable_GetMemberByIndex,
4376 d3d10_effect_vector_variable_GetMemberByName,
4377 d3d10_effect_vector_variable_GetMemberBySemantic,
4378 d3d10_effect_vector_variable_GetElement,
4379 d3d10_effect_vector_variable_GetParentConstantBuffer,
4380 d3d10_effect_vector_variable_AsScalar,
4381 d3d10_effect_vector_variable_AsVector,
4382 d3d10_effect_vector_variable_AsMatrix,
4383 d3d10_effect_vector_variable_AsString,
4384 d3d10_effect_vector_variable_AsShaderResource,
4385 d3d10_effect_vector_variable_AsRenderTargetView,
4386 d3d10_effect_vector_variable_AsDepthStencilView,
4387 d3d10_effect_vector_variable_AsConstantBuffer,
4388 d3d10_effect_vector_variable_AsShader,
4389 d3d10_effect_vector_variable_AsBlend,
4390 d3d10_effect_vector_variable_AsDepthStencil,
4391 d3d10_effect_vector_variable_AsRasterizer,
4392 d3d10_effect_vector_variable_AsSampler,
4393 d3d10_effect_vector_variable_SetRawValue,
4394 d3d10_effect_vector_variable_GetRawValue,
4395 /* ID3D10EffectVectorVariable methods */
4396 d3d10_effect_vector_variable_SetBoolVector,
4397 d3d10_effect_vector_variable_SetIntVector,
4398 d3d10_effect_vector_variable_SetFloatVector,
4399 d3d10_effect_vector_variable_GetBoolVector,
4400 d3d10_effect_vector_variable_GetIntVector,
4401 d3d10_effect_vector_variable_GetFloatVector,
4402 d3d10_effect_vector_variable_SetBoolVectorArray,
4403 d3d10_effect_vector_variable_SetIntVectorArray,
4404 d3d10_effect_vector_variable_SetFloatVectorArray,
4405 d3d10_effect_vector_variable_GetBoolVectorArray,
4406 d3d10_effect_vector_variable_GetIntVectorArray,
4407 d3d10_effect_vector_variable_GetFloatVectorArray,
4410 /* ID3D10EffectVariable methods */
4412 static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
4414 TRACE("iface %p\n", iface);
4416 return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
4419 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
4420 ID3D10EffectMatrixVariable *iface)
4422 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4425 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
4426 D3D10_EFFECT_VARIABLE_DESC *desc)
4428 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4431 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
4432 ID3D10EffectMatrixVariable *iface, UINT index)
4434 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4437 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
4438 ID3D10EffectMatrixVariable *iface, LPCSTR name)
4440 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4443 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
4444 ID3D10EffectMatrixVariable *iface, UINT index)
4446 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4449 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
4450 ID3D10EffectMatrixVariable *iface, LPCSTR name)
4452 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4455 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
4456 ID3D10EffectMatrixVariable *iface, LPCSTR semantic)
4458 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4461 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
4462 ID3D10EffectMatrixVariable *iface, UINT index)
4464 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4467 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
4468 ID3D10EffectMatrixVariable *iface)
4470 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4473 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
4474 ID3D10EffectMatrixVariable *iface)
4476 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4479 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
4480 ID3D10EffectMatrixVariable *iface)
4482 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4485 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
4486 ID3D10EffectMatrixVariable *iface)
4488 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4491 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
4492 ID3D10EffectMatrixVariable *iface)
4494 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4497 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
4498 ID3D10EffectMatrixVariable *iface)
4500 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4503 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
4504 ID3D10EffectMatrixVariable *iface)
4506 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4509 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
4510 ID3D10EffectMatrixVariable *iface)
4512 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4515 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
4516 ID3D10EffectMatrixVariable *iface)
4518 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4521 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
4522 ID3D10EffectMatrixVariable *iface)
4524 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4527 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
4528 ID3D10EffectMatrixVariable *iface)
4530 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4533 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
4534 ID3D10EffectMatrixVariable *iface)
4536 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4539 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
4540 ID3D10EffectMatrixVariable *iface)
4542 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4545 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
4546 ID3D10EffectMatrixVariable *iface)
4548 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4551 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
4552 void *data, UINT offset, UINT count)
4554 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4557 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
4558 void *data, UINT offset, UINT count)
4560 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4563 /* ID3D10EffectMatrixVariable methods */
4565 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
4566 float *data)
4568 FIXME("iface %p, data %p stub!\n", iface, data);
4570 return E_NOTIMPL;
4573 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
4574 float *data)
4576 FIXME("iface %p, data %p stub!\n", iface, data);
4578 return E_NOTIMPL;
4581 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
4582 float *data, UINT offset, UINT count)
4584 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4586 return E_NOTIMPL;
4589 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
4590 float *data, UINT offset, UINT count)
4592 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4594 return E_NOTIMPL;
4597 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4598 float *data)
4600 FIXME("iface %p, data %p stub!\n", iface, data);
4602 return E_NOTIMPL;
4605 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4606 float *data)
4608 FIXME("iface %p, data %p stub!\n", iface, data);
4610 return E_NOTIMPL;
4613 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4614 float *data, UINT offset, UINT count)
4616 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4618 return E_NOTIMPL;
4621 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4622 float *data, UINT offset, UINT count)
4624 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4626 return E_NOTIMPL;
4630 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
4632 /* ID3D10EffectVariable methods */
4633 d3d10_effect_matrix_variable_IsValid,
4634 d3d10_effect_matrix_variable_GetType,
4635 d3d10_effect_matrix_variable_GetDesc,
4636 d3d10_effect_matrix_variable_GetAnnotationByIndex,
4637 d3d10_effect_matrix_variable_GetAnnotationByName,
4638 d3d10_effect_matrix_variable_GetMemberByIndex,
4639 d3d10_effect_matrix_variable_GetMemberByName,
4640 d3d10_effect_matrix_variable_GetMemberBySemantic,
4641 d3d10_effect_matrix_variable_GetElement,
4642 d3d10_effect_matrix_variable_GetParentConstantBuffer,
4643 d3d10_effect_matrix_variable_AsScalar,
4644 d3d10_effect_matrix_variable_AsVector,
4645 d3d10_effect_matrix_variable_AsMatrix,
4646 d3d10_effect_matrix_variable_AsString,
4647 d3d10_effect_matrix_variable_AsShaderResource,
4648 d3d10_effect_matrix_variable_AsRenderTargetView,
4649 d3d10_effect_matrix_variable_AsDepthStencilView,
4650 d3d10_effect_matrix_variable_AsConstantBuffer,
4651 d3d10_effect_matrix_variable_AsShader,
4652 d3d10_effect_matrix_variable_AsBlend,
4653 d3d10_effect_matrix_variable_AsDepthStencil,
4654 d3d10_effect_matrix_variable_AsRasterizer,
4655 d3d10_effect_matrix_variable_AsSampler,
4656 d3d10_effect_matrix_variable_SetRawValue,
4657 d3d10_effect_matrix_variable_GetRawValue,
4658 /* ID3D10EffectMatrixVariable methods */
4659 d3d10_effect_matrix_variable_SetMatrix,
4660 d3d10_effect_matrix_variable_GetMatrix,
4661 d3d10_effect_matrix_variable_SetMatrixArray,
4662 d3d10_effect_matrix_variable_GetMatrixArray,
4663 d3d10_effect_matrix_variable_SetMatrixTranspose,
4664 d3d10_effect_matrix_variable_GetMatrixTranspose,
4665 d3d10_effect_matrix_variable_SetMatrixTransposeArray,
4666 d3d10_effect_matrix_variable_GetMatrixTransposeArray,
4669 /* ID3D10EffectVariable methods */
4671 static BOOL STDMETHODCALLTYPE d3d10_effect_string_variable_IsValid(ID3D10EffectStringVariable *iface)
4673 TRACE("iface %p\n", iface);
4675 return (struct d3d10_effect_variable *)iface != &null_string_variable;
4678 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_string_variable_GetType(
4679 ID3D10EffectStringVariable *iface)
4681 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4684 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetDesc(ID3D10EffectStringVariable *iface,
4685 D3D10_EFFECT_VARIABLE_DESC *desc)
4687 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4690 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByIndex(
4691 ID3D10EffectStringVariable *iface, UINT index)
4693 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4696 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByName(
4697 ID3D10EffectStringVariable *iface, LPCSTR name)
4699 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4702 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByIndex(
4703 ID3D10EffectStringVariable *iface, UINT index)
4705 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4708 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByName(
4709 ID3D10EffectStringVariable *iface, LPCSTR name)
4711 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4714 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberBySemantic(
4715 ID3D10EffectStringVariable *iface, LPCSTR semantic)
4717 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4720 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetElement(
4721 ID3D10EffectStringVariable *iface, UINT index)
4723 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4726 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_GetParentConstantBuffer(
4727 ID3D10EffectStringVariable *iface)
4729 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4732 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsScalar(
4733 ID3D10EffectStringVariable *iface)
4735 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4738 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsVector(
4739 ID3D10EffectStringVariable *iface)
4741 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4744 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsMatrix(
4745 ID3D10EffectStringVariable *iface)
4747 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4750 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsString(
4751 ID3D10EffectStringVariable *iface)
4753 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4756 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShaderResource(
4757 ID3D10EffectStringVariable *iface)
4759 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4762 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRenderTargetView(
4763 ID3D10EffectStringVariable *iface)
4765 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4768 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencilView(
4769 ID3D10EffectStringVariable *iface)
4771 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4774 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_AsConstantBuffer(
4775 ID3D10EffectStringVariable *iface)
4777 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4780 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShader(
4781 ID3D10EffectStringVariable *iface)
4783 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4786 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsBlend(
4787 ID3D10EffectStringVariable *iface)
4789 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4792 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencil(
4793 ID3D10EffectStringVariable *iface)
4795 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4798 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRasterizer(
4799 ID3D10EffectStringVariable *iface)
4801 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4804 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsSampler(
4805 ID3D10EffectStringVariable *iface)
4807 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4810 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_SetRawValue(ID3D10EffectStringVariable *iface,
4811 void *data, UINT offset, UINT count)
4813 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4816 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetRawValue(ID3D10EffectStringVariable *iface,
4817 void *data, UINT offset, UINT count)
4819 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4822 /* ID3D10EffectStringVariable methods */
4824 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetString(ID3D10EffectStringVariable *iface,
4825 LPCSTR *str)
4827 FIXME("iface %p, str %p stub!\n", iface, str);
4829 return E_NOTIMPL;
4832 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetStringArray(ID3D10EffectStringVariable *iface,
4833 LPCSTR *strs, UINT offset, UINT count)
4835 FIXME("iface %p, strs %p, offset %u, count %u stub!\n", iface, strs, offset, count);
4837 return E_NOTIMPL;
4841 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl =
4843 /* ID3D10EffectVariable methods */
4844 d3d10_effect_string_variable_IsValid,
4845 d3d10_effect_string_variable_GetType,
4846 d3d10_effect_string_variable_GetDesc,
4847 d3d10_effect_string_variable_GetAnnotationByIndex,
4848 d3d10_effect_string_variable_GetAnnotationByName,
4849 d3d10_effect_string_variable_GetMemberByIndex,
4850 d3d10_effect_string_variable_GetMemberByName,
4851 d3d10_effect_string_variable_GetMemberBySemantic,
4852 d3d10_effect_string_variable_GetElement,
4853 d3d10_effect_string_variable_GetParentConstantBuffer,
4854 d3d10_effect_string_variable_AsScalar,
4855 d3d10_effect_string_variable_AsVector,
4856 d3d10_effect_string_variable_AsMatrix,
4857 d3d10_effect_string_variable_AsString,
4858 d3d10_effect_string_variable_AsShaderResource,
4859 d3d10_effect_string_variable_AsRenderTargetView,
4860 d3d10_effect_string_variable_AsDepthStencilView,
4861 d3d10_effect_string_variable_AsConstantBuffer,
4862 d3d10_effect_string_variable_AsShader,
4863 d3d10_effect_string_variable_AsBlend,
4864 d3d10_effect_string_variable_AsDepthStencil,
4865 d3d10_effect_string_variable_AsRasterizer,
4866 d3d10_effect_string_variable_AsSampler,
4867 d3d10_effect_string_variable_SetRawValue,
4868 d3d10_effect_string_variable_GetRawValue,
4869 /* ID3D10EffectStringVariable methods */
4870 d3d10_effect_string_variable_GetString,
4871 d3d10_effect_string_variable_GetStringArray,
4874 /* ID3D10EffectVariable methods */
4876 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_IsValid(ID3D10EffectShaderResourceVariable *iface)
4878 TRACE("iface %p\n", iface);
4880 return (struct d3d10_effect_variable *)iface != &null_shader_resource_variable;
4883 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetType(
4884 ID3D10EffectShaderResourceVariable *iface)
4886 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4889 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetDesc(
4890 ID3D10EffectShaderResourceVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
4892 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4895 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByIndex(
4896 ID3D10EffectShaderResourceVariable *iface, UINT index)
4898 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4901 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByName(
4902 ID3D10EffectShaderResourceVariable *iface, LPCSTR name)
4904 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4907 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByIndex(
4908 ID3D10EffectShaderResourceVariable *iface, UINT index)
4910 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4913 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByName(
4914 ID3D10EffectShaderResourceVariable *iface, LPCSTR name)
4916 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4919 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberBySemantic(
4920 ID3D10EffectShaderResourceVariable *iface, LPCSTR semantic)
4922 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4925 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetElement(
4926 ID3D10EffectShaderResourceVariable *iface, UINT index)
4928 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4931 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetParentConstantBuffer(
4932 ID3D10EffectShaderResourceVariable *iface)
4934 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4937 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsScalar(
4938 ID3D10EffectShaderResourceVariable *iface)
4940 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4943 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsVector(
4944 ID3D10EffectShaderResourceVariable *iface)
4946 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4949 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsMatrix(
4950 ID3D10EffectShaderResourceVariable *iface)
4952 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4955 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsString(
4956 ID3D10EffectShaderResourceVariable *iface)
4958 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4961 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShaderResource(
4962 ID3D10EffectShaderResourceVariable *iface)
4964 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4967 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRenderTargetView(
4968 ID3D10EffectShaderResourceVariable *iface)
4970 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4973 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencilView(
4974 ID3D10EffectShaderResourceVariable *iface)
4976 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4979 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsConstantBuffer(
4980 ID3D10EffectShaderResourceVariable *iface)
4982 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4985 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShader(
4986 ID3D10EffectShaderResourceVariable *iface)
4988 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4991 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsBlend(
4992 ID3D10EffectShaderResourceVariable *iface)
4994 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4997 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencil(
4998 ID3D10EffectShaderResourceVariable *iface)
5000 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5003 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRasterizer(
5004 ID3D10EffectShaderResourceVariable *iface)
5006 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5009 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsSampler(
5010 ID3D10EffectShaderResourceVariable *iface)
5012 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5015 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetRawValue(
5016 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
5018 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5021 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetRawValue(
5022 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
5024 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5027 /* ID3D10EffectShaderResourceVariable methods */
5029 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResource(
5030 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView *resource)
5032 FIXME("iface %p, resource %p stub!\n", iface, resource);
5034 return E_NOTIMPL;
5037 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResource(
5038 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resource)
5040 FIXME("iface %p, resource %p stub!\n", iface, resource);
5042 return E_NOTIMPL;
5045 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResourceArray(
5046 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5048 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5050 return E_NOTIMPL;
5053 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResourceArray(
5054 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5056 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5058 return E_NOTIMPL;
5062 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl =
5064 /* ID3D10EffectVariable methods */
5065 d3d10_effect_shader_resource_variable_IsValid,
5066 d3d10_effect_shader_resource_variable_GetType,
5067 d3d10_effect_shader_resource_variable_GetDesc,
5068 d3d10_effect_shader_resource_variable_GetAnnotationByIndex,
5069 d3d10_effect_shader_resource_variable_GetAnnotationByName,
5070 d3d10_effect_shader_resource_variable_GetMemberByIndex,
5071 d3d10_effect_shader_resource_variable_GetMemberByName,
5072 d3d10_effect_shader_resource_variable_GetMemberBySemantic,
5073 d3d10_effect_shader_resource_variable_GetElement,
5074 d3d10_effect_shader_resource_variable_GetParentConstantBuffer,
5075 d3d10_effect_shader_resource_variable_AsScalar,
5076 d3d10_effect_shader_resource_variable_AsVector,
5077 d3d10_effect_shader_resource_variable_AsMatrix,
5078 d3d10_effect_shader_resource_variable_AsString,
5079 d3d10_effect_shader_resource_variable_AsShaderResource,
5080 d3d10_effect_shader_resource_variable_AsRenderTargetView,
5081 d3d10_effect_shader_resource_variable_AsDepthStencilView,
5082 d3d10_effect_shader_resource_variable_AsConstantBuffer,
5083 d3d10_effect_shader_resource_variable_AsShader,
5084 d3d10_effect_shader_resource_variable_AsBlend,
5085 d3d10_effect_shader_resource_variable_AsDepthStencil,
5086 d3d10_effect_shader_resource_variable_AsRasterizer,
5087 d3d10_effect_shader_resource_variable_AsSampler,
5088 d3d10_effect_shader_resource_variable_SetRawValue,
5089 d3d10_effect_shader_resource_variable_GetRawValue,
5090 /* ID3D10EffectShaderResourceVariable methods */
5091 d3d10_effect_shader_resource_variable_SetResource,
5092 d3d10_effect_shader_resource_variable_GetResource,
5093 d3d10_effect_shader_resource_variable_SetResourceArray,
5094 d3d10_effect_shader_resource_variable_GetResourceArray,
5097 /* ID3D10EffectVariable methods */
5099 static BOOL STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_IsValid(
5100 ID3D10EffectRenderTargetViewVariable *iface)
5102 TRACE("iface %p\n", iface);
5104 return (struct d3d10_effect_variable *)iface != &null_render_target_view_variable;
5107 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetType(
5108 ID3D10EffectRenderTargetViewVariable *iface)
5110 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5113 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetDesc(
5114 ID3D10EffectRenderTargetViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5116 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5119 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByIndex(
5120 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5122 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5125 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByName(
5126 ID3D10EffectRenderTargetViewVariable *iface, LPCSTR name)
5128 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5131 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByIndex(
5132 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5134 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5137 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByName(
5138 ID3D10EffectRenderTargetViewVariable *iface, LPCSTR name)
5140 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5143 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberBySemantic(
5144 ID3D10EffectRenderTargetViewVariable *iface, LPCSTR semantic)
5146 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5149 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetElement(
5150 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5152 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5155 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetParentConstantBuffer(
5156 ID3D10EffectRenderTargetViewVariable *iface)
5158 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5161 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsScalar(
5162 ID3D10EffectRenderTargetViewVariable *iface)
5164 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5167 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsVector(
5168 ID3D10EffectRenderTargetViewVariable *iface)
5170 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5173 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsMatrix(
5174 ID3D10EffectRenderTargetViewVariable *iface)
5176 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5179 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsString(
5180 ID3D10EffectRenderTargetViewVariable *iface)
5182 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5185 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShaderResource(
5186 ID3D10EffectRenderTargetViewVariable *iface)
5188 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5191 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRenderTargetView(
5192 ID3D10EffectRenderTargetViewVariable *iface)
5194 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5197 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencilView(
5198 ID3D10EffectRenderTargetViewVariable *iface)
5200 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5203 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsConstantBuffer(
5204 ID3D10EffectRenderTargetViewVariable *iface)
5206 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5209 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShader(
5210 ID3D10EffectRenderTargetViewVariable *iface)
5212 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5215 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsBlend(
5216 ID3D10EffectRenderTargetViewVariable *iface)
5218 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5221 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencil(
5222 ID3D10EffectRenderTargetViewVariable *iface)
5224 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5227 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRasterizer(
5228 ID3D10EffectRenderTargetViewVariable *iface)
5230 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5233 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsSampler(
5234 ID3D10EffectRenderTargetViewVariable *iface)
5236 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5239 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRawValue(
5240 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5242 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5245 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRawValue(
5246 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5248 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5251 /* ID3D10EffectRenderTargetViewVariable methods */
5253 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTarget(
5254 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView *view)
5256 FIXME("iface %p, view %p stub!\n", iface, view);
5258 return E_NOTIMPL;
5261 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTarget(
5262 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **view)
5264 FIXME("iface %p, view %p stub!\n", iface, view);
5266 return E_NOTIMPL;
5269 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTargetArray(
5270 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5272 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5274 return E_NOTIMPL;
5277 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTargetArray(
5278 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5280 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5282 return E_NOTIMPL;
5286 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl =
5288 /* ID3D10EffectVariable methods */
5289 d3d10_effect_render_target_view_variable_IsValid,
5290 d3d10_effect_render_target_view_variable_GetType,
5291 d3d10_effect_render_target_view_variable_GetDesc,
5292 d3d10_effect_render_target_view_variable_GetAnnotationByIndex,
5293 d3d10_effect_render_target_view_variable_GetAnnotationByName,
5294 d3d10_effect_render_target_view_variable_GetMemberByIndex,
5295 d3d10_effect_render_target_view_variable_GetMemberByName,
5296 d3d10_effect_render_target_view_variable_GetMemberBySemantic,
5297 d3d10_effect_render_target_view_variable_GetElement,
5298 d3d10_effect_render_target_view_variable_GetParentConstantBuffer,
5299 d3d10_effect_render_target_view_variable_AsScalar,
5300 d3d10_effect_render_target_view_variable_AsVector,
5301 d3d10_effect_render_target_view_variable_AsMatrix,
5302 d3d10_effect_render_target_view_variable_AsString,
5303 d3d10_effect_render_target_view_variable_AsShaderResource,
5304 d3d10_effect_render_target_view_variable_AsRenderTargetView,
5305 d3d10_effect_render_target_view_variable_AsDepthStencilView,
5306 d3d10_effect_render_target_view_variable_AsConstantBuffer,
5307 d3d10_effect_render_target_view_variable_AsShader,
5308 d3d10_effect_render_target_view_variable_AsBlend,
5309 d3d10_effect_render_target_view_variable_AsDepthStencil,
5310 d3d10_effect_render_target_view_variable_AsRasterizer,
5311 d3d10_effect_render_target_view_variable_AsSampler,
5312 d3d10_effect_render_target_view_variable_SetRawValue,
5313 d3d10_effect_render_target_view_variable_GetRawValue,
5314 /* ID3D10EffectRenderTargetViewVariable methods */
5315 d3d10_effect_render_target_view_variable_SetRenderTarget,
5316 d3d10_effect_render_target_view_variable_GetRenderTarget,
5317 d3d10_effect_render_target_view_variable_SetRenderTargetArray,
5318 d3d10_effect_render_target_view_variable_GetRenderTargetArray,
5321 /* ID3D10EffectVariable methods */
5323 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_IsValid(
5324 ID3D10EffectDepthStencilViewVariable *iface)
5326 TRACE("iface %p\n", iface);
5328 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_view_variable;
5331 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetType(
5332 ID3D10EffectDepthStencilViewVariable *iface)
5334 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5337 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDesc(
5338 ID3D10EffectDepthStencilViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5340 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5343 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex(
5344 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5346 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5349 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByName(
5350 ID3D10EffectDepthStencilViewVariable *iface, LPCSTR name)
5352 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5355 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByIndex(
5356 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5358 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5361 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByName(
5362 ID3D10EffectDepthStencilViewVariable *iface, LPCSTR name)
5364 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5367 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic(
5368 ID3D10EffectDepthStencilViewVariable *iface, LPCSTR semantic)
5370 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5373 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetElement(
5374 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5376 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5379 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer(
5380 ID3D10EffectDepthStencilViewVariable *iface)
5382 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5385 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsScalar(
5386 ID3D10EffectDepthStencilViewVariable *iface)
5388 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5391 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsVector(
5392 ID3D10EffectDepthStencilViewVariable *iface)
5394 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5397 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsMatrix(
5398 ID3D10EffectDepthStencilViewVariable *iface)
5400 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5403 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsString(
5404 ID3D10EffectDepthStencilViewVariable *iface)
5406 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5409 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShaderResource(
5410 ID3D10EffectDepthStencilViewVariable *iface)
5412 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5415 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRenderTargetView(
5416 ID3D10EffectDepthStencilViewVariable *iface)
5418 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5421 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencilView(
5422 ID3D10EffectDepthStencilViewVariable *iface)
5424 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5427 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsConstantBuffer(
5428 ID3D10EffectDepthStencilViewVariable *iface)
5430 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5433 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShader(
5434 ID3D10EffectDepthStencilViewVariable *iface)
5436 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5439 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsBlend(
5440 ID3D10EffectDepthStencilViewVariable *iface)
5442 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5445 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencil(
5446 ID3D10EffectDepthStencilViewVariable *iface)
5448 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5451 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRasterizer(
5452 ID3D10EffectDepthStencilViewVariable *iface)
5454 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5457 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsSampler(
5458 ID3D10EffectDepthStencilViewVariable *iface)
5460 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5463 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetRawValue(
5464 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5466 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5469 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetRawValue(
5470 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5472 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5475 /* ID3D10EffectDepthStencilViewVariable methods */
5477 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencil(
5478 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView *view)
5480 FIXME("iface %p, view %p stub!\n", iface, view);
5482 return E_NOTIMPL;
5485 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencil(
5486 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **view)
5488 FIXME("iface %p, view %p stub!\n", iface, view);
5490 return E_NOTIMPL;
5493 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray(
5494 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5496 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5498 return E_NOTIMPL;
5501 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray(
5502 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5504 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5506 return E_NOTIMPL;
5510 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl =
5512 /* ID3D10EffectVariable methods */
5513 d3d10_effect_depth_stencil_view_variable_IsValid,
5514 d3d10_effect_depth_stencil_view_variable_GetType,
5515 d3d10_effect_depth_stencil_view_variable_GetDesc,
5516 d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex,
5517 d3d10_effect_depth_stencil_view_variable_GetAnnotationByName,
5518 d3d10_effect_depth_stencil_view_variable_GetMemberByIndex,
5519 d3d10_effect_depth_stencil_view_variable_GetMemberByName,
5520 d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic,
5521 d3d10_effect_depth_stencil_view_variable_GetElement,
5522 d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer,
5523 d3d10_effect_depth_stencil_view_variable_AsScalar,
5524 d3d10_effect_depth_stencil_view_variable_AsVector,
5525 d3d10_effect_depth_stencil_view_variable_AsMatrix,
5526 d3d10_effect_depth_stencil_view_variable_AsString,
5527 d3d10_effect_depth_stencil_view_variable_AsShaderResource,
5528 d3d10_effect_depth_stencil_view_variable_AsRenderTargetView,
5529 d3d10_effect_depth_stencil_view_variable_AsDepthStencilView,
5530 d3d10_effect_depth_stencil_view_variable_AsConstantBuffer,
5531 d3d10_effect_depth_stencil_view_variable_AsShader,
5532 d3d10_effect_depth_stencil_view_variable_AsBlend,
5533 d3d10_effect_depth_stencil_view_variable_AsDepthStencil,
5534 d3d10_effect_depth_stencil_view_variable_AsRasterizer,
5535 d3d10_effect_depth_stencil_view_variable_AsSampler,
5536 d3d10_effect_depth_stencil_view_variable_SetRawValue,
5537 d3d10_effect_depth_stencil_view_variable_GetRawValue,
5538 /* ID3D10EffectDepthStencilViewVariable methods */
5539 d3d10_effect_depth_stencil_view_variable_SetDepthStencil,
5540 d3d10_effect_depth_stencil_view_variable_GetDepthStencil,
5541 d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray,
5542 d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray,
5545 /* ID3D10EffectVariable methods */
5547 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_variable_IsValid(ID3D10EffectShaderVariable *iface)
5549 TRACE("iface %p\n", iface);
5551 return (struct d3d10_effect_variable *)iface != &null_shader_variable;
5554 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetType(
5555 ID3D10EffectShaderVariable *iface)
5557 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5560 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetDesc(ID3D10EffectShaderVariable *iface,
5561 D3D10_EFFECT_VARIABLE_DESC *desc)
5563 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5566 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByIndex(
5567 ID3D10EffectShaderVariable *iface, UINT index)
5569 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5572 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByName(
5573 ID3D10EffectShaderVariable *iface, LPCSTR name)
5575 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5578 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByIndex(
5579 ID3D10EffectShaderVariable *iface, UINT index)
5581 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5584 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByName(
5585 ID3D10EffectShaderVariable *iface, LPCSTR name)
5587 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5590 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberBySemantic(
5591 ID3D10EffectShaderVariable *iface, LPCSTR semantic)
5593 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5596 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetElement(
5597 ID3D10EffectShaderVariable *iface, UINT index)
5599 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5602 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetParentConstantBuffer(
5603 ID3D10EffectShaderVariable *iface)
5605 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5608 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsScalar(
5609 ID3D10EffectShaderVariable *iface)
5611 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5614 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsVector(
5615 ID3D10EffectShaderVariable *iface)
5617 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5620 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsMatrix(
5621 ID3D10EffectShaderVariable *iface)
5623 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5626 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsString(
5627 ID3D10EffectShaderVariable *iface)
5629 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5632 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShaderResource(
5633 ID3D10EffectShaderVariable *iface)
5635 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5638 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRenderTargetView(
5639 ID3D10EffectShaderVariable *iface)
5641 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5644 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencilView(
5645 ID3D10EffectShaderVariable *iface)
5647 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5650 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsConstantBuffer(
5651 ID3D10EffectShaderVariable *iface)
5653 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5656 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShader(
5657 ID3D10EffectShaderVariable *iface)
5659 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5662 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsBlend(
5663 ID3D10EffectShaderVariable *iface)
5665 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5668 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencil(
5669 ID3D10EffectShaderVariable *iface)
5671 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5674 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRasterizer(
5675 ID3D10EffectShaderVariable *iface)
5677 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5680 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsSampler(
5681 ID3D10EffectShaderVariable *iface)
5683 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5686 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_SetRawValue(
5687 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5689 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5692 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetRawValue(
5693 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5695 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5698 /* ID3D10EffectShaderVariable methods */
5700 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetShaderDesc(
5701 ID3D10EffectShaderVariable *iface, UINT index, D3D10_EFFECT_SHADER_DESC *desc)
5703 FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc);
5705 return E_NOTIMPL;
5708 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetVertexShader(
5709 ID3D10EffectShaderVariable *iface, UINT index, ID3D10VertexShader **shader)
5711 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5713 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5715 if (v->type->element_count)
5716 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5718 if (v->type->basetype != D3D10_SVT_VERTEXSHADER)
5720 WARN("Shader is not a vertex shader.\n");
5721 return E_FAIL;
5724 if ((*shader = v->u.shader.shader.vs))
5725 ID3D10VertexShader_AddRef(*shader);
5727 return S_OK;
5730 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetGeometryShader(
5731 ID3D10EffectShaderVariable *iface, UINT index, ID3D10GeometryShader **shader)
5733 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5735 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5737 if (v->type->element_count)
5738 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5740 if (v->type->basetype != D3D10_SVT_GEOMETRYSHADER)
5742 WARN("Shader is not a geometry shader.\n");
5743 return E_FAIL;
5746 if ((*shader = v->u.shader.shader.gs))
5747 ID3D10GeometryShader_AddRef(*shader);
5749 return S_OK;
5752 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetPixelShader(
5753 ID3D10EffectShaderVariable *iface, UINT index, ID3D10PixelShader **shader)
5755 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5757 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5759 if (v->type->element_count)
5760 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5762 if (v->type->basetype != D3D10_SVT_PIXELSHADER)
5764 WARN("Shader is not a pixel shader.\n");
5765 return E_FAIL;
5768 if ((*shader = v->u.shader.shader.ps))
5769 ID3D10PixelShader_AddRef(*shader);
5771 return S_OK;
5774 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetInputSignatureElementDesc(
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->input_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->input_signature.element_count)
5814 WARN("Invalid element index specified\n");
5815 return E_INVALIDARG;
5818 d = &s->input_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;
5830 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetOutputSignatureElementDesc(
5831 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5832 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5834 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5835 struct d3d10_effect_shader_variable *s;
5836 D3D10_SIGNATURE_PARAMETER_DESC *d;
5838 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5839 iface, shader_index, element_index, desc);
5841 if (!iface->lpVtbl->IsValid(iface))
5843 WARN("Null variable specified\n");
5844 return E_FAIL;
5847 /* Check shader_index, this crashes on W7/DX10 */
5848 if (shader_index >= This->effect->used_shader_count)
5850 WARN("This should crash on W7/DX10!\n");
5851 return E_FAIL;
5854 s = &This->effect->used_shaders[shader_index]->u.shader;
5855 if (!s->output_signature.signature)
5857 WARN("No shader signature\n");
5858 return D3DERR_INVALIDCALL;
5861 /* Check desc for NULL, this crashes on W7/DX10 */
5862 if (!desc)
5864 WARN("This should crash on W7/DX10!\n");
5865 return E_FAIL;
5868 if (element_index >= s->output_signature.element_count)
5870 WARN("Invalid element index specified\n");
5871 return E_INVALIDARG;
5874 d = &s->output_signature.elements[element_index];
5875 desc->SemanticName = d->SemanticName;
5876 desc->SemanticIndex = d->SemanticIndex;
5877 desc->SystemValueType = d->SystemValueType;
5878 desc->ComponentType = d->ComponentType;
5879 desc->Register = d->Register;
5880 desc->ReadWriteMask = d->ReadWriteMask;
5881 desc->Mask = d->Mask;
5883 return S_OK;
5887 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl =
5889 /* ID3D10EffectVariable methods */
5890 d3d10_effect_shader_variable_IsValid,
5891 d3d10_effect_shader_variable_GetType,
5892 d3d10_effect_shader_variable_GetDesc,
5893 d3d10_effect_shader_variable_GetAnnotationByIndex,
5894 d3d10_effect_shader_variable_GetAnnotationByName,
5895 d3d10_effect_shader_variable_GetMemberByIndex,
5896 d3d10_effect_shader_variable_GetMemberByName,
5897 d3d10_effect_shader_variable_GetMemberBySemantic,
5898 d3d10_effect_shader_variable_GetElement,
5899 d3d10_effect_shader_variable_GetParentConstantBuffer,
5900 d3d10_effect_shader_variable_AsScalar,
5901 d3d10_effect_shader_variable_AsVector,
5902 d3d10_effect_shader_variable_AsMatrix,
5903 d3d10_effect_shader_variable_AsString,
5904 d3d10_effect_shader_variable_AsShaderResource,
5905 d3d10_effect_shader_variable_AsRenderTargetView,
5906 d3d10_effect_shader_variable_AsDepthStencilView,
5907 d3d10_effect_shader_variable_AsConstantBuffer,
5908 d3d10_effect_shader_variable_AsShader,
5909 d3d10_effect_shader_variable_AsBlend,
5910 d3d10_effect_shader_variable_AsDepthStencil,
5911 d3d10_effect_shader_variable_AsRasterizer,
5912 d3d10_effect_shader_variable_AsSampler,
5913 d3d10_effect_shader_variable_SetRawValue,
5914 d3d10_effect_shader_variable_GetRawValue,
5915 /* ID3D10EffectShaderVariable methods */
5916 d3d10_effect_shader_variable_GetShaderDesc,
5917 d3d10_effect_shader_variable_GetVertexShader,
5918 d3d10_effect_shader_variable_GetGeometryShader,
5919 d3d10_effect_shader_variable_GetPixelShader,
5920 d3d10_effect_shader_variable_GetInputSignatureElementDesc,
5921 d3d10_effect_shader_variable_GetOutputSignatureElementDesc,
5924 /* ID3D10EffectVariable methods */
5926 static BOOL STDMETHODCALLTYPE d3d10_effect_blend_variable_IsValid(ID3D10EffectBlendVariable *iface)
5928 TRACE("iface %p\n", iface);
5930 return (struct d3d10_effect_variable *)iface != &null_blend_variable;
5933 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetType(
5934 ID3D10EffectBlendVariable *iface)
5936 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5939 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetDesc(ID3D10EffectBlendVariable *iface,
5940 D3D10_EFFECT_VARIABLE_DESC *desc)
5942 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5945 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByIndex(
5946 ID3D10EffectBlendVariable *iface, UINT index)
5948 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5951 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByName(
5952 ID3D10EffectBlendVariable *iface, LPCSTR name)
5954 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5957 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByIndex(
5958 ID3D10EffectBlendVariable *iface, UINT index)
5960 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5963 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByName(
5964 ID3D10EffectBlendVariable *iface, LPCSTR name)
5966 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5969 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberBySemantic(
5970 ID3D10EffectBlendVariable *iface, LPCSTR semantic)
5972 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5975 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetElement(
5976 ID3D10EffectBlendVariable *iface, UINT index)
5978 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5981 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetParentConstantBuffer(
5982 ID3D10EffectBlendVariable *iface)
5984 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5987 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsScalar(
5988 ID3D10EffectBlendVariable *iface)
5990 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5993 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsVector(
5994 ID3D10EffectBlendVariable *iface)
5996 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5999 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsMatrix(
6000 ID3D10EffectBlendVariable *iface)
6002 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6005 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsString(
6006 ID3D10EffectBlendVariable *iface)
6008 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6011 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShaderResource(
6012 ID3D10EffectBlendVariable *iface)
6014 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6017 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRenderTargetView(
6018 ID3D10EffectBlendVariable *iface)
6020 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6023 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencilView(
6024 ID3D10EffectBlendVariable *iface)
6026 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6029 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsConstantBuffer(
6030 ID3D10EffectBlendVariable *iface)
6032 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6035 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShader(
6036 ID3D10EffectBlendVariable *iface)
6038 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6041 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsBlend(
6042 ID3D10EffectBlendVariable *iface)
6044 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6047 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencil(
6048 ID3D10EffectBlendVariable *iface)
6050 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6053 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRasterizer(
6054 ID3D10EffectBlendVariable *iface)
6056 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6059 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsSampler(
6060 ID3D10EffectBlendVariable *iface)
6062 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6065 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_SetRawValue(ID3D10EffectBlendVariable *iface,
6066 void *data, UINT offset, UINT count)
6068 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6071 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetRawValue(ID3D10EffectBlendVariable *iface,
6072 void *data, UINT offset, UINT count)
6074 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6077 /* ID3D10EffectBlendVariable methods */
6079 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBlendState(ID3D10EffectBlendVariable *iface,
6080 UINT index, ID3D10BlendState **blend_state)
6082 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6084 TRACE("iface %p, index %u, blend_state %p.\n", iface, index, blend_state);
6086 if (v->type->element_count)
6087 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6088 else if (index)
6089 return E_FAIL;
6091 if (v->type->basetype != D3D10_SVT_BLEND)
6093 WARN("Variable is not a blend state.\n");
6094 return E_FAIL;
6097 if ((*blend_state = v->u.state.object.blend))
6098 ID3D10BlendState_AddRef(*blend_state);
6100 return S_OK;
6103 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBackingStore(ID3D10EffectBlendVariable *iface,
6104 UINT index, D3D10_BLEND_DESC *desc)
6106 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6108 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6110 if (v->type->element_count)
6111 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6113 if (v->type->basetype != D3D10_SVT_BLEND)
6115 WARN("Variable is not a blend state.\n");
6116 return E_FAIL;
6119 *desc = v->u.state.desc.blend;
6121 return S_OK;
6125 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl =
6127 /* ID3D10EffectVariable methods */
6128 d3d10_effect_blend_variable_IsValid,
6129 d3d10_effect_blend_variable_GetType,
6130 d3d10_effect_blend_variable_GetDesc,
6131 d3d10_effect_blend_variable_GetAnnotationByIndex,
6132 d3d10_effect_blend_variable_GetAnnotationByName,
6133 d3d10_effect_blend_variable_GetMemberByIndex,
6134 d3d10_effect_blend_variable_GetMemberByName,
6135 d3d10_effect_blend_variable_GetMemberBySemantic,
6136 d3d10_effect_blend_variable_GetElement,
6137 d3d10_effect_blend_variable_GetParentConstantBuffer,
6138 d3d10_effect_blend_variable_AsScalar,
6139 d3d10_effect_blend_variable_AsVector,
6140 d3d10_effect_blend_variable_AsMatrix,
6141 d3d10_effect_blend_variable_AsString,
6142 d3d10_effect_blend_variable_AsShaderResource,
6143 d3d10_effect_blend_variable_AsRenderTargetView,
6144 d3d10_effect_blend_variable_AsDepthStencilView,
6145 d3d10_effect_blend_variable_AsConstantBuffer,
6146 d3d10_effect_blend_variable_AsShader,
6147 d3d10_effect_blend_variable_AsBlend,
6148 d3d10_effect_blend_variable_AsDepthStencil,
6149 d3d10_effect_blend_variable_AsRasterizer,
6150 d3d10_effect_blend_variable_AsSampler,
6151 d3d10_effect_blend_variable_SetRawValue,
6152 d3d10_effect_blend_variable_GetRawValue,
6153 /* ID3D10EffectBlendVariable methods */
6154 d3d10_effect_blend_variable_GetBlendState,
6155 d3d10_effect_blend_variable_GetBackingStore,
6158 /* ID3D10EffectVariable methods */
6160 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_IsValid(ID3D10EffectDepthStencilVariable *iface)
6162 TRACE("iface %p\n", iface);
6164 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_variable;
6167 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetType(
6168 ID3D10EffectDepthStencilVariable *iface)
6170 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6173 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDesc(ID3D10EffectDepthStencilVariable *iface,
6174 D3D10_EFFECT_VARIABLE_DESC *desc)
6176 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6179 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByIndex(
6180 ID3D10EffectDepthStencilVariable *iface, UINT index)
6182 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6185 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByName(
6186 ID3D10EffectDepthStencilVariable *iface, LPCSTR name)
6188 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6191 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByIndex(
6192 ID3D10EffectDepthStencilVariable *iface, UINT index)
6194 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6197 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByName(
6198 ID3D10EffectDepthStencilVariable *iface, LPCSTR name)
6200 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6203 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberBySemantic(
6204 ID3D10EffectDepthStencilVariable *iface, LPCSTR semantic)
6206 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6209 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetElement(
6210 ID3D10EffectDepthStencilVariable *iface, UINT index)
6212 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6215 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetParentConstantBuffer(
6216 ID3D10EffectDepthStencilVariable *iface)
6218 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6221 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsScalar(
6222 ID3D10EffectDepthStencilVariable *iface)
6224 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6227 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsVector(
6228 ID3D10EffectDepthStencilVariable *iface)
6230 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6233 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsMatrix(
6234 ID3D10EffectDepthStencilVariable *iface)
6236 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6239 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsString(
6240 ID3D10EffectDepthStencilVariable *iface)
6242 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6245 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShaderResource(
6246 ID3D10EffectDepthStencilVariable *iface)
6248 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6251 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRenderTargetView(
6252 ID3D10EffectDepthStencilVariable *iface)
6254 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6257 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencilView(
6258 ID3D10EffectDepthStencilVariable *iface)
6260 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6263 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsConstantBuffer(
6264 ID3D10EffectDepthStencilVariable *iface)
6266 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6269 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShader(
6270 ID3D10EffectDepthStencilVariable *iface)
6272 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6275 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsBlend(
6276 ID3D10EffectDepthStencilVariable *iface)
6278 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6281 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencil(
6282 ID3D10EffectDepthStencilVariable *iface)
6284 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6287 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRasterizer(
6288 ID3D10EffectDepthStencilVariable *iface)
6290 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6293 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsSampler(
6294 ID3D10EffectDepthStencilVariable *iface)
6296 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6299 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_SetRawValue(ID3D10EffectDepthStencilVariable *iface,
6300 void *data, UINT offset, UINT count)
6302 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6305 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetRawValue(ID3D10EffectDepthStencilVariable *iface,
6306 void *data, UINT offset, UINT count)
6308 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6311 /* ID3D10EffectDepthStencilVariable methods */
6313 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDepthStencilState(ID3D10EffectDepthStencilVariable *iface,
6314 UINT index, ID3D10DepthStencilState **depth_stencil_state)
6316 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6318 TRACE("iface %p, index %u, depth_stencil_state %p.\n", iface, index, depth_stencil_state);
6320 if (v->type->element_count)
6321 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6322 else if (index)
6323 return E_FAIL;
6325 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6327 WARN("Variable is not a depth stencil state.\n");
6328 return E_FAIL;
6331 if ((*depth_stencil_state = v->u.state.object.depth_stencil))
6332 ID3D10DepthStencilState_AddRef(*depth_stencil_state);
6334 return S_OK;
6337 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetBackingStore(ID3D10EffectDepthStencilVariable *iface,
6338 UINT index, D3D10_DEPTH_STENCIL_DESC *desc)
6340 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6342 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6344 if (v->type->element_count)
6345 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6347 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6349 WARN("Variable is not a depth stencil state.\n");
6350 return E_FAIL;
6353 *desc = v->u.state.desc.depth_stencil;
6355 return S_OK;
6359 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl =
6361 /* ID3D10EffectVariable methods */
6362 d3d10_effect_depth_stencil_variable_IsValid,
6363 d3d10_effect_depth_stencil_variable_GetType,
6364 d3d10_effect_depth_stencil_variable_GetDesc,
6365 d3d10_effect_depth_stencil_variable_GetAnnotationByIndex,
6366 d3d10_effect_depth_stencil_variable_GetAnnotationByName,
6367 d3d10_effect_depth_stencil_variable_GetMemberByIndex,
6368 d3d10_effect_depth_stencil_variable_GetMemberByName,
6369 d3d10_effect_depth_stencil_variable_GetMemberBySemantic,
6370 d3d10_effect_depth_stencil_variable_GetElement,
6371 d3d10_effect_depth_stencil_variable_GetParentConstantBuffer,
6372 d3d10_effect_depth_stencil_variable_AsScalar,
6373 d3d10_effect_depth_stencil_variable_AsVector,
6374 d3d10_effect_depth_stencil_variable_AsMatrix,
6375 d3d10_effect_depth_stencil_variable_AsString,
6376 d3d10_effect_depth_stencil_variable_AsShaderResource,
6377 d3d10_effect_depth_stencil_variable_AsRenderTargetView,
6378 d3d10_effect_depth_stencil_variable_AsDepthStencilView,
6379 d3d10_effect_depth_stencil_variable_AsConstantBuffer,
6380 d3d10_effect_depth_stencil_variable_AsShader,
6381 d3d10_effect_depth_stencil_variable_AsBlend,
6382 d3d10_effect_depth_stencil_variable_AsDepthStencil,
6383 d3d10_effect_depth_stencil_variable_AsRasterizer,
6384 d3d10_effect_depth_stencil_variable_AsSampler,
6385 d3d10_effect_depth_stencil_variable_SetRawValue,
6386 d3d10_effect_depth_stencil_variable_GetRawValue,
6387 /* ID3D10EffectDepthStencilVariable methods */
6388 d3d10_effect_depth_stencil_variable_GetDepthStencilState,
6389 d3d10_effect_depth_stencil_variable_GetBackingStore,
6392 /* ID3D10EffectVariable methods */
6394 static BOOL STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_IsValid(ID3D10EffectRasterizerVariable *iface)
6396 TRACE("iface %p\n", iface);
6398 return (struct d3d10_effect_variable *)iface != &null_rasterizer_variable;
6401 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetType(
6402 ID3D10EffectRasterizerVariable *iface)
6404 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6407 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetDesc(ID3D10EffectRasterizerVariable *iface,
6408 D3D10_EFFECT_VARIABLE_DESC *desc)
6410 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6413 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByIndex(
6414 ID3D10EffectRasterizerVariable *iface, UINT index)
6416 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6419 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByName(
6420 ID3D10EffectRasterizerVariable *iface, LPCSTR name)
6422 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6425 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByIndex(
6426 ID3D10EffectRasterizerVariable *iface, UINT index)
6428 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6431 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByName(
6432 ID3D10EffectRasterizerVariable *iface, LPCSTR name)
6434 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6437 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberBySemantic(
6438 ID3D10EffectRasterizerVariable *iface, LPCSTR semantic)
6440 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6443 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetElement(
6444 ID3D10EffectRasterizerVariable *iface, UINT index)
6446 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6449 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetParentConstantBuffer(
6450 ID3D10EffectRasterizerVariable *iface)
6452 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6455 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsScalar(
6456 ID3D10EffectRasterizerVariable *iface)
6458 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6461 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsVector(
6462 ID3D10EffectRasterizerVariable *iface)
6464 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6467 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsMatrix(
6468 ID3D10EffectRasterizerVariable *iface)
6470 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6473 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsString(
6474 ID3D10EffectRasterizerVariable *iface)
6476 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6479 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShaderResource(
6480 ID3D10EffectRasterizerVariable *iface)
6482 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6485 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRenderTargetView(
6486 ID3D10EffectRasterizerVariable *iface)
6488 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6491 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencilView(
6492 ID3D10EffectRasterizerVariable *iface)
6494 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6497 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsConstantBuffer(
6498 ID3D10EffectRasterizerVariable *iface)
6500 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6503 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShader(
6504 ID3D10EffectRasterizerVariable *iface)
6506 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6509 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsBlend(
6510 ID3D10EffectRasterizerVariable *iface)
6512 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6515 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencil(
6516 ID3D10EffectRasterizerVariable *iface)
6518 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6521 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRasterizer(
6522 ID3D10EffectRasterizerVariable *iface)
6524 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6527 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsSampler(
6528 ID3D10EffectRasterizerVariable *iface)
6530 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6533 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_SetRawValue(ID3D10EffectRasterizerVariable *iface,
6534 void *data, UINT offset, UINT count)
6536 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6539 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRawValue(ID3D10EffectRasterizerVariable *iface,
6540 void *data, UINT offset, UINT count)
6542 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6545 /* ID3D10EffectRasterizerVariable methods */
6547 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRasterizerState(ID3D10EffectRasterizerVariable *iface,
6548 UINT index, ID3D10RasterizerState **rasterizer_state)
6550 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6552 TRACE("iface %p, index %u, rasterizer_state %p.\n", iface, index, rasterizer_state);
6554 if (v->type->element_count)
6555 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6556 else if (index)
6557 return E_FAIL;
6559 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6561 WARN("Variable is not a rasterizer state.\n");
6562 return E_FAIL;
6565 if ((*rasterizer_state = v->u.state.object.rasterizer))
6566 ID3D10RasterizerState_AddRef(*rasterizer_state);
6568 return S_OK;
6571 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetBackingStore(ID3D10EffectRasterizerVariable *iface,
6572 UINT index, D3D10_RASTERIZER_DESC *desc)
6574 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6576 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6578 if (v->type->element_count)
6579 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6581 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6583 WARN("Variable is not a rasterizer state.\n");
6584 return E_FAIL;
6587 *desc = v->u.state.desc.rasterizer;
6589 return S_OK;
6593 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl =
6595 /* ID3D10EffectVariable methods */
6596 d3d10_effect_rasterizer_variable_IsValid,
6597 d3d10_effect_rasterizer_variable_GetType,
6598 d3d10_effect_rasterizer_variable_GetDesc,
6599 d3d10_effect_rasterizer_variable_GetAnnotationByIndex,
6600 d3d10_effect_rasterizer_variable_GetAnnotationByName,
6601 d3d10_effect_rasterizer_variable_GetMemberByIndex,
6602 d3d10_effect_rasterizer_variable_GetMemberByName,
6603 d3d10_effect_rasterizer_variable_GetMemberBySemantic,
6604 d3d10_effect_rasterizer_variable_GetElement,
6605 d3d10_effect_rasterizer_variable_GetParentConstantBuffer,
6606 d3d10_effect_rasterizer_variable_AsScalar,
6607 d3d10_effect_rasterizer_variable_AsVector,
6608 d3d10_effect_rasterizer_variable_AsMatrix,
6609 d3d10_effect_rasterizer_variable_AsString,
6610 d3d10_effect_rasterizer_variable_AsShaderResource,
6611 d3d10_effect_rasterizer_variable_AsRenderTargetView,
6612 d3d10_effect_rasterizer_variable_AsDepthStencilView,
6613 d3d10_effect_rasterizer_variable_AsConstantBuffer,
6614 d3d10_effect_rasterizer_variable_AsShader,
6615 d3d10_effect_rasterizer_variable_AsBlend,
6616 d3d10_effect_rasterizer_variable_AsDepthStencil,
6617 d3d10_effect_rasterizer_variable_AsRasterizer,
6618 d3d10_effect_rasterizer_variable_AsSampler,
6619 d3d10_effect_rasterizer_variable_SetRawValue,
6620 d3d10_effect_rasterizer_variable_GetRawValue,
6621 /* ID3D10EffectRasterizerVariable methods */
6622 d3d10_effect_rasterizer_variable_GetRasterizerState,
6623 d3d10_effect_rasterizer_variable_GetBackingStore,
6626 /* ID3D10EffectVariable methods */
6628 static BOOL STDMETHODCALLTYPE d3d10_effect_sampler_variable_IsValid(ID3D10EffectSamplerVariable *iface)
6630 TRACE("iface %p\n", iface);
6632 return (struct d3d10_effect_variable *)iface != &null_sampler_variable;
6635 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetType(
6636 ID3D10EffectSamplerVariable *iface)
6638 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6641 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetDesc(ID3D10EffectSamplerVariable *iface,
6642 D3D10_EFFECT_VARIABLE_DESC *desc)
6644 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6647 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByIndex(
6648 ID3D10EffectSamplerVariable *iface, UINT index)
6650 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6653 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByName(
6654 ID3D10EffectSamplerVariable *iface, LPCSTR name)
6656 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6659 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByIndex(
6660 ID3D10EffectSamplerVariable *iface, UINT index)
6662 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6665 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByName(
6666 ID3D10EffectSamplerVariable *iface, LPCSTR name)
6668 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6671 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberBySemantic(
6672 ID3D10EffectSamplerVariable *iface, LPCSTR semantic)
6674 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6677 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetElement(
6678 ID3D10EffectSamplerVariable *iface, UINT index)
6680 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6683 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetParentConstantBuffer(
6684 ID3D10EffectSamplerVariable *iface)
6686 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6689 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsScalar(
6690 ID3D10EffectSamplerVariable *iface)
6692 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6695 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsVector(
6696 ID3D10EffectSamplerVariable *iface)
6698 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6701 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsMatrix(
6702 ID3D10EffectSamplerVariable *iface)
6704 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6707 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsString(
6708 ID3D10EffectSamplerVariable *iface)
6710 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6713 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShaderResource(
6714 ID3D10EffectSamplerVariable *iface)
6716 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6719 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRenderTargetView(
6720 ID3D10EffectSamplerVariable *iface)
6722 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6725 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencilView(
6726 ID3D10EffectSamplerVariable *iface)
6728 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6731 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsConstantBuffer(
6732 ID3D10EffectSamplerVariable *iface)
6734 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6737 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShader(
6738 ID3D10EffectSamplerVariable *iface)
6740 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6743 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsBlend(
6744 ID3D10EffectSamplerVariable *iface)
6746 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6749 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencil(
6750 ID3D10EffectSamplerVariable *iface)
6752 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6755 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRasterizer(
6756 ID3D10EffectSamplerVariable *iface)
6758 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6761 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsSampler(
6762 ID3D10EffectSamplerVariable *iface)
6764 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6767 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_SetRawValue(ID3D10EffectSamplerVariable *iface,
6768 void *data, UINT offset, UINT count)
6770 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6773 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetRawValue(ID3D10EffectSamplerVariable *iface,
6774 void *data, UINT offset, UINT count)
6776 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6779 /* ID3D10EffectSamplerVariable methods */
6781 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetSampler(ID3D10EffectSamplerVariable *iface,
6782 UINT index, ID3D10SamplerState **sampler)
6784 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6786 TRACE("iface %p, index %u, sampler %p.\n", iface, index, sampler);
6788 if (v->type->element_count)
6789 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6790 else if (index)
6791 return E_FAIL;
6793 if (v->type->basetype != D3D10_SVT_SAMPLER)
6795 WARN("Variable is not a sampler state.\n");
6796 return E_FAIL;
6799 if ((*sampler = v->u.state.object.sampler))
6800 ID3D10SamplerState_AddRef(*sampler);
6802 return S_OK;
6805 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetBackingStore(ID3D10EffectSamplerVariable *iface,
6806 UINT index, D3D10_SAMPLER_DESC *desc)
6808 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6810 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6812 if (v->type->element_count)
6813 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6815 if (v->type->basetype != D3D10_SVT_SAMPLER)
6817 WARN("Variable is not a sampler state.\n");
6818 return E_FAIL;
6821 *desc = v->u.state.desc.sampler;
6823 return S_OK;
6827 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl =
6829 /* ID3D10EffectVariable methods */
6830 d3d10_effect_sampler_variable_IsValid,
6831 d3d10_effect_sampler_variable_GetType,
6832 d3d10_effect_sampler_variable_GetDesc,
6833 d3d10_effect_sampler_variable_GetAnnotationByIndex,
6834 d3d10_effect_sampler_variable_GetAnnotationByName,
6835 d3d10_effect_sampler_variable_GetMemberByIndex,
6836 d3d10_effect_sampler_variable_GetMemberByName,
6837 d3d10_effect_sampler_variable_GetMemberBySemantic,
6838 d3d10_effect_sampler_variable_GetElement,
6839 d3d10_effect_sampler_variable_GetParentConstantBuffer,
6840 d3d10_effect_sampler_variable_AsScalar,
6841 d3d10_effect_sampler_variable_AsVector,
6842 d3d10_effect_sampler_variable_AsMatrix,
6843 d3d10_effect_sampler_variable_AsString,
6844 d3d10_effect_sampler_variable_AsShaderResource,
6845 d3d10_effect_sampler_variable_AsRenderTargetView,
6846 d3d10_effect_sampler_variable_AsDepthStencilView,
6847 d3d10_effect_sampler_variable_AsConstantBuffer,
6848 d3d10_effect_sampler_variable_AsShader,
6849 d3d10_effect_sampler_variable_AsBlend,
6850 d3d10_effect_sampler_variable_AsDepthStencil,
6851 d3d10_effect_sampler_variable_AsRasterizer,
6852 d3d10_effect_sampler_variable_AsSampler,
6853 d3d10_effect_sampler_variable_SetRawValue,
6854 d3d10_effect_sampler_variable_GetRawValue,
6855 /* ID3D10EffectSamplerVariable methods */
6856 d3d10_effect_sampler_variable_GetSampler,
6857 d3d10_effect_sampler_variable_GetBackingStore,
6860 /* ID3D10EffectType methods */
6862 static inline struct d3d10_effect_type *impl_from_ID3D10EffectType(ID3D10EffectType *iface)
6864 return CONTAINING_RECORD(iface, struct d3d10_effect_type, ID3D10EffectType_iface);
6867 static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
6869 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6871 TRACE("iface %p\n", iface);
6873 return This != &null_type;
6876 static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *iface, D3D10_EFFECT_TYPE_DESC *desc)
6878 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6880 TRACE("iface %p, desc %p\n", iface, desc);
6882 if (This == &null_type)
6884 WARN("Null type specified\n");
6885 return E_FAIL;
6888 if (!desc)
6890 WARN("Invalid argument specified\n");
6891 return E_INVALIDARG;
6894 desc->TypeName = This->name;
6895 desc->Class = This->type_class;
6896 desc->Type = This->basetype;
6897 desc->Elements = This->element_count;
6898 desc->Members = This->member_count;
6899 desc->Rows = This->row_count;
6900 desc->Columns = This->column_count;
6901 desc->PackedSize = This->size_packed;
6902 desc->UnpackedSize = This->size_unpacked;
6903 desc->Stride = This->stride;
6905 return S_OK;
6908 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByIndex(ID3D10EffectType *iface,
6909 UINT index)
6911 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6912 struct d3d10_effect_type *t;
6914 TRACE("iface %p, index %u\n", iface, index);
6916 if (index >= This->member_count)
6918 WARN("Invalid index specified\n");
6919 return &null_type.ID3D10EffectType_iface;
6922 t = (&This->members[index])->type;
6924 TRACE("Returning member %p, %s\n", t, debugstr_a(t->name));
6926 return &t->ID3D10EffectType_iface;
6929 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByName(ID3D10EffectType *iface,
6930 LPCSTR name)
6932 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6933 unsigned int i;
6935 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
6937 if (!name)
6939 WARN("Invalid name specified\n");
6940 return &null_type.ID3D10EffectType_iface;
6943 for (i = 0; i < This->member_count; ++i)
6945 struct d3d10_effect_type_member *typem = &This->members[i];
6947 if (typem->name)
6949 if (!strcmp(typem->name, name))
6951 TRACE("Returning type %p.\n", typem->type);
6952 return &typem->type->ID3D10EffectType_iface;
6957 WARN("Invalid name specified\n");
6959 return &null_type.ID3D10EffectType_iface;
6962 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeBySemantic(ID3D10EffectType *iface,
6963 LPCSTR semantic)
6965 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6966 unsigned int i;
6968 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
6970 if (!semantic)
6972 WARN("Invalid semantic specified\n");
6973 return &null_type.ID3D10EffectType_iface;
6976 for (i = 0; i < This->member_count; ++i)
6978 struct d3d10_effect_type_member *typem = &This->members[i];
6980 if (typem->semantic)
6982 if (!strcmp(typem->semantic, semantic))
6984 TRACE("Returning type %p.\n", typem->type);
6985 return &typem->type->ID3D10EffectType_iface;
6990 WARN("Invalid semantic specified\n");
6992 return &null_type.ID3D10EffectType_iface;
6995 static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberName(ID3D10EffectType *iface, UINT index)
6997 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6998 struct d3d10_effect_type_member *typem;
7000 TRACE("iface %p, index %u\n", iface, index);
7002 if (index >= This->member_count)
7004 WARN("Invalid index specified\n");
7005 return NULL;
7008 typem = &This->members[index];
7010 TRACE("Returning name %s\n", debugstr_a(typem->name));
7012 return typem->name;
7015 static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberSemantic(ID3D10EffectType *iface, UINT index)
7017 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7018 struct d3d10_effect_type_member *typem;
7020 TRACE("iface %p, index %u\n", iface, index);
7022 if (index >= This->member_count)
7024 WARN("Invalid index specified\n");
7025 return NULL;
7028 typem = &This->members[index];
7030 TRACE("Returning semantic %s\n", debugstr_a(typem->semantic));
7032 return typem->semantic;
7035 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl =
7037 /* ID3D10EffectType */
7038 d3d10_effect_type_IsValid,
7039 d3d10_effect_type_GetDesc,
7040 d3d10_effect_type_GetMemberTypeByIndex,
7041 d3d10_effect_type_GetMemberTypeByName,
7042 d3d10_effect_type_GetMemberTypeBySemantic,
7043 d3d10_effect_type_GetMemberName,
7044 d3d10_effect_type_GetMemberSemantic,