kernel32/tests: Ensure that pipe tests read the full pipe content.
[wine/wine-gecko.git] / dlls / d3d10 / effect.c
blobc7eed1a1faab611317a879b31af415412aab5627
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 case D3D10_SVT_DEPTHSTENCIL:
2294 if (v->u.state.object.depth_stencil)
2295 ID3D10DepthStencilState_Release(v->u.state.object.depth_stencil);
2296 break;
2298 case D3D10_SVT_BLEND:
2299 if (v->u.state.object.blend)
2300 ID3D10BlendState_Release(v->u.state.object.blend);
2301 break;
2303 case D3D10_SVT_RASTERIZER:
2304 if (v->u.state.object.rasterizer)
2305 ID3D10RasterizerState_Release(v->u.state.object.rasterizer);
2306 break;
2308 case D3D10_SVT_SAMPLER:
2309 if (v->u.state.object.sampler)
2310 ID3D10SamplerState_Release(v->u.state.object.sampler);
2311 break;
2313 default:
2314 break;
2318 static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
2320 switch (o->type)
2322 case D3D10_EOT_RASTERIZER_STATE:
2323 if (o->object.rs)
2324 ID3D10RasterizerState_Release(o->object.rs);
2325 break;
2327 case D3D10_EOT_DEPTH_STENCIL_STATE:
2328 if (o->object.ds)
2329 ID3D10DepthStencilState_Release(o->object.ds);
2330 break;
2332 case D3D10_EOT_BLEND_STATE:
2333 if (o->object.bs)
2334 ID3D10BlendState_Release(o->object.bs);
2335 break;
2337 case D3D10_EOT_VERTEXSHADER:
2338 if (o->object.vs)
2339 ID3D10VertexShader_Release(o->object.vs);
2340 break;
2342 case D3D10_EOT_PIXELSHADER:
2343 if (o->object.ps)
2344 ID3D10PixelShader_Release(o->object.ps);
2345 break;
2347 case D3D10_EOT_GEOMETRYSHADER:
2348 if (o->object.gs)
2349 ID3D10GeometryShader_Release(o->object.gs);
2350 break;
2352 default:
2353 break;
2357 static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
2359 unsigned int i;
2361 TRACE("pass %p\n", p);
2363 HeapFree(GetProcessHeap(), 0, p->name);
2365 if (p->objects)
2367 for (i = 0; i < p->object_count; ++i)
2369 d3d10_effect_object_destroy(&p->objects[i]);
2371 HeapFree(GetProcessHeap(), 0, p->objects);
2374 if (p->annotations)
2376 for (i = 0; i < p->annotation_count; ++i)
2378 d3d10_effect_variable_destroy(&p->annotations[i]);
2380 HeapFree(GetProcessHeap(), 0, p->annotations);
2384 static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
2386 unsigned int i;
2388 TRACE("technique %p\n", t);
2390 HeapFree(GetProcessHeap(), 0, t->name);
2391 if (t->passes)
2393 for (i = 0; i < t->pass_count; ++i)
2395 d3d10_effect_pass_destroy(&t->passes[i]);
2397 HeapFree(GetProcessHeap(), 0, t->passes);
2400 if (t->annotations)
2402 for (i = 0; i < t->annotation_count; ++i)
2404 d3d10_effect_variable_destroy(&t->annotations[i]);
2406 HeapFree(GetProcessHeap(), 0, t->annotations);
2410 static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
2412 unsigned int i;
2414 TRACE("local buffer %p.\n", l);
2416 HeapFree(GetProcessHeap(), 0, l->name);
2417 if (l->members)
2419 for (i = 0; i < l->type->member_count; ++i)
2421 d3d10_effect_variable_destroy(&l->members[i]);
2423 HeapFree(GetProcessHeap(), 0, l->members);
2426 if (l->type->members)
2428 for (i = 0; i < l->type->member_count; ++i)
2430 /* Do not release l->type->members[i].type, it will be covered by d3d10_effect_type_destroy(). */
2431 HeapFree(GetProcessHeap(), 0, l->type->members[i].semantic);
2432 HeapFree(GetProcessHeap(), 0, l->type->members[i].name);
2434 HeapFree(GetProcessHeap(), 0, l->type->members);
2436 HeapFree(GetProcessHeap(), 0, l->type->name);
2437 HeapFree(GetProcessHeap(), 0, l->type);
2439 if (l->annotations)
2441 for (i = 0; i < l->annotation_count; ++i)
2443 d3d10_effect_variable_destroy(&l->annotations[i]);
2445 HeapFree(GetProcessHeap(), 0, l->annotations);
2449 /* IUnknown methods */
2451 static inline struct d3d10_effect *impl_from_ID3D10Effect(ID3D10Effect *iface)
2453 return CONTAINING_RECORD(iface, struct d3d10_effect, ID3D10Effect_iface);
2456 static HRESULT STDMETHODCALLTYPE d3d10_effect_QueryInterface(ID3D10Effect *iface, REFIID riid, void **object)
2458 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
2460 if (IsEqualGUID(riid, &IID_ID3D10Effect)
2461 || IsEqualGUID(riid, &IID_IUnknown))
2463 IUnknown_AddRef(iface);
2464 *object = iface;
2465 return S_OK;
2468 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
2470 *object = NULL;
2471 return E_NOINTERFACE;
2474 static ULONG STDMETHODCALLTYPE d3d10_effect_AddRef(ID3D10Effect *iface)
2476 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2477 ULONG refcount = InterlockedIncrement(&This->refcount);
2479 TRACE("%p increasing refcount to %u\n", This, refcount);
2481 return refcount;
2484 static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
2486 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2487 ULONG refcount = InterlockedDecrement(&This->refcount);
2489 TRACE("%p decreasing refcount to %u\n", This, refcount);
2491 if (!refcount)
2493 unsigned int i;
2495 if (This->techniques)
2497 for (i = 0; i < This->technique_count; ++i)
2499 d3d10_effect_technique_destroy(&This->techniques[i]);
2501 HeapFree(GetProcessHeap(), 0, This->techniques);
2504 if (This->local_variables)
2506 for (i = 0; i < This->local_variable_count; ++i)
2508 d3d10_effect_variable_destroy(&This->local_variables[i]);
2510 HeapFree(GetProcessHeap(), 0, This->local_variables);
2513 if (This->local_buffers)
2515 for (i = 0; i < This->local_buffer_count; ++i)
2517 d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
2519 HeapFree(GetProcessHeap(), 0, This->local_buffers);
2522 if (This->anonymous_shaders)
2524 for (i = 0; i < This->anonymous_shader_count; ++i)
2526 d3d10_effect_variable_destroy(&This->anonymous_shaders[i].shader);
2527 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders[i].type.name);
2529 HeapFree(GetProcessHeap(), 0, This->anonymous_shaders);
2532 HeapFree(GetProcessHeap(), 0, This->used_shaders);
2534 wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
2536 ID3D10Device_Release(This->device);
2537 HeapFree(GetProcessHeap(), 0, This);
2540 return refcount;
2543 /* ID3D10Effect methods */
2545 static BOOL STDMETHODCALLTYPE d3d10_effect_IsValid(ID3D10Effect *iface)
2547 FIXME("iface %p stub!\n", iface);
2549 return FALSE;
2552 static BOOL STDMETHODCALLTYPE d3d10_effect_IsPool(ID3D10Effect *iface)
2554 FIXME("iface %p stub!\n", iface);
2556 return FALSE;
2559 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3D10Device **device)
2561 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2563 TRACE("iface %p, device %p\n", iface, device);
2565 ID3D10Device_AddRef(This->device);
2566 *device = This->device;
2568 return S_OK;
2571 static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc)
2573 FIXME("iface %p, desc %p stub!\n", iface, desc);
2575 return E_NOTIMPL;
2578 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface,
2579 UINT index)
2581 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2582 struct d3d10_effect_variable *l;
2584 TRACE("iface %p, index %u\n", iface, index);
2586 if (index >= This->local_buffer_count)
2588 WARN("Invalid index specified\n");
2589 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2592 l = &This->local_buffers[index];
2594 TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
2596 return (ID3D10EffectConstantBuffer *)l;
2599 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
2600 const char *name)
2602 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2603 unsigned int i;
2605 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2607 for (i = 0; i < This->local_buffer_count; ++i)
2609 struct d3d10_effect_variable *l = &This->local_buffers[i];
2611 if (!strcmp(l->name, name))
2613 TRACE("Returning buffer %p.\n", l);
2614 return (ID3D10EffectConstantBuffer *)l;
2618 WARN("Invalid name specified\n");
2620 return (ID3D10EffectConstantBuffer *)&null_local_buffer;
2623 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
2625 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2626 unsigned int i;
2628 TRACE("iface %p, index %u\n", iface, index);
2630 for (i = 0; i < This->local_buffer_count; ++i)
2632 struct d3d10_effect_variable *l = &This->local_buffers[i];
2634 if (index < l->type->member_count)
2636 struct d3d10_effect_variable *v = &l->members[index];
2638 TRACE("Returning variable %p.\n", v);
2639 return &v->ID3D10EffectVariable_iface;
2641 index -= l->type->member_count;
2644 if (index < This->local_variable_count)
2646 struct d3d10_effect_variable *v = &This->local_variables[index];
2648 TRACE("Returning variable %p.\n", v);
2649 return &v->ID3D10EffectVariable_iface;
2652 WARN("Invalid index specified\n");
2654 return &null_variable.ID3D10EffectVariable_iface;
2657 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByName(ID3D10Effect *iface,
2658 const char *name)
2660 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2661 unsigned int i;
2663 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2665 if (!name)
2667 WARN("Invalid name specified\n");
2668 return &null_variable.ID3D10EffectVariable_iface;
2671 for (i = 0; i < This->local_buffer_count; ++i)
2673 struct d3d10_effect_variable *l = &This->local_buffers[i];
2674 unsigned int j;
2676 for (j = 0; j < l->type->member_count; ++j)
2678 struct d3d10_effect_variable *v = &l->members[j];
2680 if (!strcmp(v->name, name))
2682 TRACE("Returning variable %p.\n", v);
2683 return &v->ID3D10EffectVariable_iface;
2688 for (i = 0; i < This->local_variable_count; ++i)
2690 struct d3d10_effect_variable *v = &This->local_variables[i];
2692 if (!strcmp(v->name, name))
2694 TRACE("Returning variable %p.\n", v);
2695 return &v->ID3D10EffectVariable_iface;
2699 WARN("Invalid name specified\n");
2701 return &null_variable.ID3D10EffectVariable_iface;
2704 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableBySemantic(ID3D10Effect *iface,
2705 const char *semantic)
2707 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2708 unsigned int i;
2710 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
2712 if (!semantic)
2714 WARN("Invalid semantic specified\n");
2715 return &null_variable.ID3D10EffectVariable_iface;
2718 for (i = 0; i < This->local_buffer_count; ++i)
2720 struct d3d10_effect_variable *l = &This->local_buffers[i];
2721 unsigned int j;
2723 for (j = 0; j < l->type->member_count; ++j)
2725 struct d3d10_effect_variable *v = &l->members[j];
2727 if (!strcmp(v->semantic, semantic))
2729 TRACE("Returning variable %p.\n", v);
2730 return &v->ID3D10EffectVariable_iface;
2735 for (i = 0; i < This->local_variable_count; ++i)
2737 struct d3d10_effect_variable *v = &This->local_variables[i];
2739 if (!strcmp(v->semantic, semantic))
2741 TRACE("Returning variable %p.\n", v);
2742 return &v->ID3D10EffectVariable_iface;
2746 WARN("Invalid semantic specified\n");
2748 return &null_variable.ID3D10EffectVariable_iface;
2751 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByIndex(ID3D10Effect *iface,
2752 UINT index)
2754 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2755 struct d3d10_effect_technique *t;
2757 TRACE("iface %p, index %u\n", iface, index);
2759 if (index >= This->technique_count)
2761 WARN("Invalid index specified\n");
2762 return &null_technique.ID3D10EffectTechnique_iface;
2765 t = &This->techniques[index];
2767 TRACE("Returning technique %p, %s.\n", t, debugstr_a(t->name));
2769 return &t->ID3D10EffectTechnique_iface;
2772 static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqueByName(ID3D10Effect *iface,
2773 const char *name)
2775 struct d3d10_effect *This = impl_from_ID3D10Effect(iface);
2776 unsigned int i;
2778 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2780 if (!name)
2782 WARN("Invalid name specified\n");
2783 return &null_technique.ID3D10EffectTechnique_iface;
2786 for (i = 0; i < This->technique_count; ++i)
2788 struct d3d10_effect_technique *t = &This->techniques[i];
2789 if (!strcmp(t->name, name))
2791 TRACE("Returning technique %p\n", t);
2792 return &t->ID3D10EffectTechnique_iface;
2796 WARN("Invalid name specified\n");
2798 return &null_technique.ID3D10EffectTechnique_iface;
2801 static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
2803 FIXME("iface %p stub!\n", iface);
2805 return E_NOTIMPL;
2808 static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
2810 FIXME("iface %p stub!\n", iface);
2812 return FALSE;
2815 const struct ID3D10EffectVtbl d3d10_effect_vtbl =
2817 /* IUnknown methods */
2818 d3d10_effect_QueryInterface,
2819 d3d10_effect_AddRef,
2820 d3d10_effect_Release,
2821 /* ID3D10Effect methods */
2822 d3d10_effect_IsValid,
2823 d3d10_effect_IsPool,
2824 d3d10_effect_GetDevice,
2825 d3d10_effect_GetDesc,
2826 d3d10_effect_GetConstantBufferByIndex,
2827 d3d10_effect_GetConstantBufferByName,
2828 d3d10_effect_GetVariableByIndex,
2829 d3d10_effect_GetVariableByName,
2830 d3d10_effect_GetVariableBySemantic,
2831 d3d10_effect_GetTechniqueByIndex,
2832 d3d10_effect_GetTechniqueByName,
2833 d3d10_effect_Optimize,
2834 d3d10_effect_IsOptimized,
2837 /* ID3D10EffectTechnique methods */
2839 static inline struct d3d10_effect_technique *impl_from_ID3D10EffectTechnique(ID3D10EffectTechnique *iface)
2841 return CONTAINING_RECORD(iface, struct d3d10_effect_technique, ID3D10EffectTechnique_iface);
2844 static BOOL STDMETHODCALLTYPE d3d10_effect_technique_IsValid(ID3D10EffectTechnique *iface)
2846 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2848 TRACE("iface %p\n", iface);
2850 return This != &null_technique;
2853 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_GetDesc(ID3D10EffectTechnique *iface,
2854 D3D10_TECHNIQUE_DESC *desc)
2856 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2858 TRACE("iface %p, desc %p\n", iface, desc);
2860 if(This == &null_technique)
2862 WARN("Null technique specified\n");
2863 return E_FAIL;
2866 if(!desc)
2868 WARN("Invalid argument specified\n");
2869 return E_INVALIDARG;
2872 desc->Name = This->name;
2873 desc->Passes = This->pass_count;
2874 desc->Annotations = This->annotation_count;
2876 return S_OK;
2879 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByIndex(
2880 ID3D10EffectTechnique *iface, UINT index)
2882 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2883 struct d3d10_effect_variable *a;
2885 TRACE("iface %p, index %u\n", iface, index);
2887 if (index >= This->annotation_count)
2889 WARN("Invalid index specified\n");
2890 return &null_variable.ID3D10EffectVariable_iface;
2893 a = &This->annotations[index];
2895 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
2897 return &a->ID3D10EffectVariable_iface;
2900 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_technique_GetAnnotationByName(
2901 ID3D10EffectTechnique *iface, const char *name)
2903 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2904 unsigned int i;
2906 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2908 for (i = 0; i < This->annotation_count; ++i)
2910 struct d3d10_effect_variable *a = &This->annotations[i];
2911 if (!strcmp(a->name, name))
2913 TRACE("Returning annotation %p\n", a);
2914 return &a->ID3D10EffectVariable_iface;
2918 WARN("Invalid name specified\n");
2920 return &null_variable.ID3D10EffectVariable_iface;
2923 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByIndex(ID3D10EffectTechnique *iface,
2924 UINT index)
2926 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2927 struct d3d10_effect_pass *p;
2929 TRACE("iface %p, index %u\n", iface, index);
2931 if (index >= This->pass_count)
2933 WARN("Invalid index specified\n");
2934 return &null_pass.ID3D10EffectPass_iface;
2937 p = &This->passes[index];
2939 TRACE("Returning pass %p, %s.\n", p, debugstr_a(p->name));
2941 return &p->ID3D10EffectPass_iface;
2944 static struct ID3D10EffectPass * STDMETHODCALLTYPE d3d10_effect_technique_GetPassByName(ID3D10EffectTechnique *iface,
2945 const char *name)
2947 struct d3d10_effect_technique *This = impl_from_ID3D10EffectTechnique(iface);
2948 unsigned int i;
2950 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2952 /* Do not check for name==NULL, W7/DX10 crashes in that case. */
2954 for (i = 0; i < This->pass_count; ++i)
2956 struct d3d10_effect_pass *p = &This->passes[i];
2957 if (!strcmp(p->name, name))
2959 TRACE("Returning pass %p\n", p);
2960 return &p->ID3D10EffectPass_iface;
2964 WARN("Invalid name specified\n");
2966 return &null_pass.ID3D10EffectPass_iface;
2969 static HRESULT STDMETHODCALLTYPE d3d10_effect_technique_ComputeStateBlockMask(ID3D10EffectTechnique *iface,
2970 D3D10_STATE_BLOCK_MASK *mask)
2972 FIXME("iface %p,mask %p stub!\n", iface, mask);
2974 return E_NOTIMPL;
2977 static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl =
2979 /* ID3D10EffectTechnique methods */
2980 d3d10_effect_technique_IsValid,
2981 d3d10_effect_technique_GetDesc,
2982 d3d10_effect_technique_GetAnnotationByIndex,
2983 d3d10_effect_technique_GetAnnotationByName,
2984 d3d10_effect_technique_GetPassByIndex,
2985 d3d10_effect_technique_GetPassByName,
2986 d3d10_effect_technique_ComputeStateBlockMask,
2989 /* ID3D10EffectPass methods */
2991 static inline struct d3d10_effect_pass *impl_from_ID3D10EffectPass(ID3D10EffectPass *iface)
2993 return CONTAINING_RECORD(iface, struct d3d10_effect_pass, ID3D10EffectPass_iface);
2996 static BOOL STDMETHODCALLTYPE d3d10_effect_pass_IsValid(ID3D10EffectPass *iface)
2998 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3000 TRACE("iface %p\n", iface);
3002 return This != &null_pass;
3005 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetDesc(ID3D10EffectPass *iface,
3006 D3D10_PASS_DESC *desc)
3008 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3009 struct d3d10_effect_shader_variable *s;
3011 FIXME("iface %p, desc %p partial stub!\n", iface, desc);
3013 if(This == &null_pass)
3015 WARN("Null pass specified\n");
3016 return E_FAIL;
3019 if(!desc)
3021 WARN("Invalid argument specified\n");
3022 return E_INVALIDARG;
3025 memset(desc, 0, sizeof(*desc));
3026 desc->Name = This->name;
3028 s = &impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)This->vs.pShaderVariable)->u.shader;
3029 desc->pIAInputSignature = (BYTE *)s->input_signature.signature;
3030 desc->IAInputSignatureSize = s->input_signature.signature_size;
3032 desc->StencilRef = This->stencil_ref;
3033 desc->SampleMask = This->sample_mask;
3034 memcpy(desc->BlendFactor, This->blend_factor, 4 * sizeof(float));
3036 return S_OK;
3039 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetVertexShaderDesc(ID3D10EffectPass *iface,
3040 D3D10_PASS_SHADER_DESC *desc)
3042 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3044 TRACE("iface %p, desc %p\n", iface, desc);
3046 if (This == &null_pass)
3048 WARN("Null pass specified\n");
3049 return E_FAIL;
3052 if (!desc)
3054 WARN("Invalid argument specified\n");
3055 return E_INVALIDARG;
3058 *desc = This->vs;
3060 return S_OK;
3063 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetGeometryShaderDesc(ID3D10EffectPass *iface,
3064 D3D10_PASS_SHADER_DESC *desc)
3066 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3068 TRACE("iface %p, desc %p\n", iface, desc);
3070 if (This == &null_pass)
3072 WARN("Null pass specified\n");
3073 return E_FAIL;
3076 if (!desc)
3078 WARN("Invalid argument specified\n");
3079 return E_INVALIDARG;
3082 *desc = This->gs;
3084 return S_OK;
3087 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_GetPixelShaderDesc(ID3D10EffectPass *iface,
3088 D3D10_PASS_SHADER_DESC *desc)
3090 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3092 TRACE("iface %p, desc %p\n", iface, desc);
3094 if (This == &null_pass)
3096 WARN("Null pass specified\n");
3097 return E_FAIL;
3100 if (!desc)
3102 WARN("Invalid argument specified\n");
3103 return E_INVALIDARG;
3106 *desc = This->ps;
3108 return S_OK;
3111 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByIndex(ID3D10EffectPass *iface,
3112 UINT index)
3114 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3115 struct d3d10_effect_variable *a;
3117 TRACE("iface %p, index %u\n", iface, index);
3119 if (index >= This->annotation_count)
3121 WARN("Invalid index specified\n");
3122 return &null_variable.ID3D10EffectVariable_iface;
3125 a = &This->annotations[index];
3127 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3129 return &a->ID3D10EffectVariable_iface;
3132 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_pass_GetAnnotationByName(ID3D10EffectPass *iface,
3133 const char *name)
3135 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3136 unsigned int i;
3138 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3140 for (i = 0; i < This->annotation_count; ++i)
3142 struct d3d10_effect_variable *a = &This->annotations[i];
3143 if (!strcmp(a->name, name))
3145 TRACE("Returning annotation %p\n", a);
3146 return &a->ID3D10EffectVariable_iface;
3150 WARN("Invalid name specified\n");
3152 return &null_variable.ID3D10EffectVariable_iface;
3155 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface, UINT flags)
3157 struct d3d10_effect_pass *This = impl_from_ID3D10EffectPass(iface);
3158 HRESULT hr = S_OK;
3159 unsigned int i;
3161 TRACE("iface %p, flags %#x\n", iface, flags);
3163 if (flags) FIXME("Ignoring flags (%#x)\n", flags);
3165 for (i = 0; i < This->object_count; ++i)
3167 hr = d3d10_effect_object_apply(&This->objects[i]);
3168 if (FAILED(hr)) break;
3171 return hr;
3174 static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_ComputeStateBlockMask(ID3D10EffectPass *iface,
3175 D3D10_STATE_BLOCK_MASK *mask)
3177 FIXME("iface %p, mask %p stub!\n", iface, mask);
3179 return E_NOTIMPL;
3182 static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl =
3184 /* ID3D10EffectPass methods */
3185 d3d10_effect_pass_IsValid,
3186 d3d10_effect_pass_GetDesc,
3187 d3d10_effect_pass_GetVertexShaderDesc,
3188 d3d10_effect_pass_GetGeometryShaderDesc,
3189 d3d10_effect_pass_GetPixelShaderDesc,
3190 d3d10_effect_pass_GetAnnotationByIndex,
3191 d3d10_effect_pass_GetAnnotationByName,
3192 d3d10_effect_pass_Apply,
3193 d3d10_effect_pass_ComputeStateBlockMask,
3196 /* ID3D10EffectVariable methods */
3198 static BOOL STDMETHODCALLTYPE d3d10_effect_variable_IsValid(ID3D10EffectVariable *iface)
3200 TRACE("iface %p\n", iface);
3202 return impl_from_ID3D10EffectVariable(iface) != &null_variable;
3205 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_variable_GetType(ID3D10EffectVariable *iface)
3207 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3209 TRACE("iface %p\n", iface);
3211 return &This->type->ID3D10EffectType_iface;
3214 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetDesc(ID3D10EffectVariable *iface,
3215 D3D10_EFFECT_VARIABLE_DESC *desc)
3217 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3219 TRACE("iface %p, desc %p\n", iface, desc);
3221 if (!iface->lpVtbl->IsValid(iface))
3223 WARN("Null variable specified\n");
3224 return E_FAIL;
3227 if (!desc)
3229 WARN("Invalid argument specified\n");
3230 return E_INVALIDARG;
3233 /* FIXME: This isn't correct. Anonymous shaders let desc->ExplicitBindPoint untouched, but normal shaders set it! */
3234 memset(desc, 0, sizeof(*desc));
3235 desc->Name = This->name;
3236 desc->Semantic = This->semantic;
3237 desc->Flags = This->flag;
3238 desc->Annotations = This->annotation_count;
3239 desc->BufferOffset = This->buffer_offset;
3241 if (This->flag & D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT)
3243 desc->ExplicitBindPoint = This->buffer_offset;
3246 return S_OK;
3249 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByIndex(
3250 ID3D10EffectVariable *iface, UINT index)
3252 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3253 struct d3d10_effect_variable *a;
3255 TRACE("iface %p, index %u\n", iface, index);
3257 if (index >= This->annotation_count)
3259 WARN("Invalid index specified\n");
3260 return &null_variable.ID3D10EffectVariable_iface;
3263 a = &This->annotations[index];
3265 TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name));
3267 return &a->ID3D10EffectVariable_iface;
3270 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetAnnotationByName(
3271 ID3D10EffectVariable *iface, const char *name)
3273 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3274 unsigned int i;
3276 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3278 for (i = 0; i < This->annotation_count; ++i)
3280 struct d3d10_effect_variable *a = &This->annotations[i];
3281 if (!strcmp(a->name, name))
3283 TRACE("Returning annotation %p\n", a);
3284 return &a->ID3D10EffectVariable_iface;
3288 WARN("Invalid name specified\n");
3290 return &null_variable.ID3D10EffectVariable_iface;
3293 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex(
3294 ID3D10EffectVariable *iface, UINT index)
3296 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3297 struct d3d10_effect_variable *m;
3299 TRACE("iface %p, index %u\n", iface, index);
3301 if (index >= This->type->member_count)
3303 WARN("Invalid index specified\n");
3304 return &null_variable.ID3D10EffectVariable_iface;
3307 m = &This->members[index];
3309 TRACE("Returning member %p, %s\n", m, debugstr_a(m->name));
3311 return &m->ID3D10EffectVariable_iface;
3314 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName(
3315 ID3D10EffectVariable *iface, const char *name)
3317 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3318 unsigned int i;
3320 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3322 if (!name)
3324 WARN("Invalid name specified\n");
3325 return &null_variable.ID3D10EffectVariable_iface;
3328 for (i = 0; i < This->type->member_count; ++i)
3330 struct d3d10_effect_variable *m = &This->members[i];
3332 if (m->name)
3334 if (!strcmp(m->name, name))
3336 TRACE("Returning member %p\n", m);
3337 return &m->ID3D10EffectVariable_iface;
3342 WARN("Invalid name specified\n");
3344 return &null_variable.ID3D10EffectVariable_iface;
3347 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic(
3348 ID3D10EffectVariable *iface, const char *semantic)
3350 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3351 unsigned int i;
3353 TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic));
3355 if (!semantic)
3357 WARN("Invalid semantic specified\n");
3358 return &null_variable.ID3D10EffectVariable_iface;
3361 for (i = 0; i < This->type->member_count; ++i)
3363 struct d3d10_effect_variable *m = &This->members[i];
3365 if (m->semantic)
3367 if (!strcmp(m->semantic, semantic))
3369 TRACE("Returning member %p\n", m);
3370 return &m->ID3D10EffectVariable_iface;
3375 WARN("Invalid semantic specified\n");
3377 return &null_variable.ID3D10EffectVariable_iface;
3380 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement(
3381 ID3D10EffectVariable *iface, UINT index)
3383 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3384 struct d3d10_effect_variable *v;
3386 TRACE("iface %p, index %u\n", iface, index);
3388 if (index >= This->type->element_count)
3390 WARN("Invalid index specified\n");
3391 return &null_variable.ID3D10EffectVariable_iface;
3394 v = &This->elements[index];
3396 TRACE("Returning element %p, %s\n", v, debugstr_a(v->name));
3398 return &v->ID3D10EffectVariable_iface;
3401 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_GetParentConstantBuffer(
3402 ID3D10EffectVariable *iface)
3404 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3406 TRACE("iface %p\n", iface);
3408 return (ID3D10EffectConstantBuffer *)This->buffer;
3411 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
3412 ID3D10EffectVariable *iface)
3414 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3416 TRACE("iface %p\n", iface);
3418 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
3419 return (ID3D10EffectScalarVariable *)&This->ID3D10EffectVariable_iface;
3421 return (ID3D10EffectScalarVariable *)&null_scalar_variable.ID3D10EffectVariable_iface;
3424 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
3425 ID3D10EffectVariable *iface)
3427 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3429 TRACE("iface %p\n", iface);
3431 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl)
3432 return (ID3D10EffectVectorVariable *)&This->ID3D10EffectVariable_iface;
3434 return (ID3D10EffectVectorVariable *)&null_vector_variable.ID3D10EffectVariable_iface;
3437 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
3438 ID3D10EffectVariable *iface)
3440 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3442 TRACE("iface %p\n", iface);
3444 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl)
3445 return (ID3D10EffectMatrixVariable *)&This->ID3D10EffectVariable_iface;
3447 return (ID3D10EffectMatrixVariable *)&null_matrix_variable.ID3D10EffectVariable_iface;
3450 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
3451 ID3D10EffectVariable *iface)
3453 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3455 TRACE("iface %p\n", iface);
3457 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl)
3458 return (ID3D10EffectStringVariable *)&This->ID3D10EffectVariable_iface;
3460 return (ID3D10EffectStringVariable *)&null_string_variable.ID3D10EffectVariable_iface;
3463 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShaderResource(
3464 ID3D10EffectVariable *iface)
3466 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3468 TRACE("iface %p\n", iface);
3470 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_resource_variable_vtbl)
3471 return (ID3D10EffectShaderResourceVariable *)&This->ID3D10EffectVariable_iface;
3473 return (ID3D10EffectShaderResourceVariable *)&null_shader_resource_variable.ID3D10EffectVariable_iface;
3476 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRenderTargetView(
3477 ID3D10EffectVariable *iface)
3479 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3481 TRACE("iface %p\n", iface);
3483 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_render_target_view_variable_vtbl)
3484 return (ID3D10EffectRenderTargetViewVariable *)&This->ID3D10EffectVariable_iface;
3486 return (ID3D10EffectRenderTargetViewVariable *)&null_render_target_view_variable.ID3D10EffectVariable_iface;
3489 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencilView(
3490 ID3D10EffectVariable *iface)
3492 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3494 TRACE("iface %p\n", iface);
3496 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_view_variable_vtbl)
3497 return (ID3D10EffectDepthStencilViewVariable *)&This->ID3D10EffectVariable_iface;
3499 return (ID3D10EffectDepthStencilViewVariable *)&null_depth_stencil_view_variable.ID3D10EffectVariable_iface;
3502 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variable_AsConstantBuffer(
3503 ID3D10EffectVariable *iface)
3505 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3507 TRACE("iface %p\n", iface);
3509 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl)
3510 return (ID3D10EffectConstantBuffer *)&This->ID3D10EffectVariable_iface;
3512 return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface;
3515 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsShader(
3516 ID3D10EffectVariable *iface)
3518 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3520 TRACE("iface %p\n", iface);
3522 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_shader_variable_vtbl)
3523 return (ID3D10EffectShaderVariable *)&This->ID3D10EffectVariable_iface;
3525 return (ID3D10EffectShaderVariable *)&null_shader_variable.ID3D10EffectVariable_iface;
3528 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsBlend(ID3D10EffectVariable *iface)
3530 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3532 TRACE("iface %p\n", iface);
3534 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_blend_variable_vtbl)
3535 return (ID3D10EffectBlendVariable *)&This->ID3D10EffectVariable_iface;
3537 return (ID3D10EffectBlendVariable *)&null_blend_variable.ID3D10EffectVariable_iface;
3540 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsDepthStencil(
3541 ID3D10EffectVariable *iface)
3543 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3545 TRACE("iface %p\n", iface);
3547 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_depth_stencil_variable_vtbl)
3548 return (ID3D10EffectDepthStencilVariable *)&This->ID3D10EffectVariable_iface;
3550 return (ID3D10EffectDepthStencilVariable *)&null_depth_stencil_variable.ID3D10EffectVariable_iface;
3553 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsRasterizer(
3554 ID3D10EffectVariable *iface)
3556 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3558 TRACE("iface %p\n", iface);
3560 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_rasterizer_variable_vtbl)
3561 return (ID3D10EffectRasterizerVariable *)&This->ID3D10EffectVariable_iface;
3563 return (ID3D10EffectRasterizerVariable *)&null_rasterizer_variable.ID3D10EffectVariable_iface;
3566 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsSampler(
3567 ID3D10EffectVariable *iface)
3569 struct d3d10_effect_variable *This = impl_from_ID3D10EffectVariable(iface);
3571 TRACE("iface %p\n", iface);
3573 if (This->ID3D10EffectVariable_iface.lpVtbl == (const ID3D10EffectVariableVtbl *)&d3d10_effect_sampler_variable_vtbl)
3574 return (ID3D10EffectSamplerVariable *)&This->ID3D10EffectVariable_iface;
3576 return (ID3D10EffectSamplerVariable *)&null_sampler_variable.ID3D10EffectVariable_iface;
3579 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
3580 void *data, UINT offset, UINT count)
3582 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3584 return E_NOTIMPL;
3587 static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
3588 void *data, UINT offset, UINT count)
3590 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
3592 return E_NOTIMPL;
3595 static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl =
3597 /* ID3D10EffectVariable methods */
3598 d3d10_effect_variable_IsValid,
3599 d3d10_effect_variable_GetType,
3600 d3d10_effect_variable_GetDesc,
3601 d3d10_effect_variable_GetAnnotationByIndex,
3602 d3d10_effect_variable_GetAnnotationByName,
3603 d3d10_effect_variable_GetMemberByIndex,
3604 d3d10_effect_variable_GetMemberByName,
3605 d3d10_effect_variable_GetMemberBySemantic,
3606 d3d10_effect_variable_GetElement,
3607 d3d10_effect_variable_GetParentConstantBuffer,
3608 d3d10_effect_variable_AsScalar,
3609 d3d10_effect_variable_AsVector,
3610 d3d10_effect_variable_AsMatrix,
3611 d3d10_effect_variable_AsString,
3612 d3d10_effect_variable_AsShaderResource,
3613 d3d10_effect_variable_AsRenderTargetView,
3614 d3d10_effect_variable_AsDepthStencilView,
3615 d3d10_effect_variable_AsConstantBuffer,
3616 d3d10_effect_variable_AsShader,
3617 d3d10_effect_variable_AsBlend,
3618 d3d10_effect_variable_AsDepthStencil,
3619 d3d10_effect_variable_AsRasterizer,
3620 d3d10_effect_variable_AsSampler,
3621 d3d10_effect_variable_SetRawValue,
3622 d3d10_effect_variable_GetRawValue,
3625 /* ID3D10EffectVariable methods */
3626 static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface)
3628 TRACE("iface %p\n", iface);
3630 return (struct d3d10_effect_variable *)iface != &null_local_buffer;
3633 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
3635 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3638 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface,
3639 D3D10_EFFECT_VARIABLE_DESC *desc)
3641 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3644 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex(
3645 ID3D10EffectConstantBuffer *iface, UINT index)
3647 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3650 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName(
3651 ID3D10EffectConstantBuffer *iface, const char *name)
3653 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3656 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex(
3657 ID3D10EffectConstantBuffer *iface, UINT index)
3659 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3662 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName(
3663 ID3D10EffectConstantBuffer *iface, const char *name)
3665 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3668 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic(
3669 ID3D10EffectConstantBuffer *iface, const char *semantic)
3671 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3674 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement(
3675 ID3D10EffectConstantBuffer *iface, UINT index)
3677 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3680 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer(
3681 ID3D10EffectConstantBuffer *iface)
3683 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3686 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar(
3687 ID3D10EffectConstantBuffer *iface)
3689 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3692 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector(
3693 ID3D10EffectConstantBuffer *iface)
3695 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3698 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix(
3699 ID3D10EffectConstantBuffer *iface)
3701 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3704 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString(
3705 ID3D10EffectConstantBuffer *iface)
3707 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3710 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource(
3711 ID3D10EffectConstantBuffer *iface)
3713 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3716 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView(
3717 ID3D10EffectConstantBuffer *iface)
3719 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3722 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView(
3723 ID3D10EffectConstantBuffer *iface)
3725 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3728 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer(
3729 ID3D10EffectConstantBuffer *iface)
3731 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3734 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader(
3735 ID3D10EffectConstantBuffer *iface)
3737 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3740 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface)
3742 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3745 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil(
3746 ID3D10EffectConstantBuffer *iface)
3748 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3751 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer(
3752 ID3D10EffectConstantBuffer *iface)
3754 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3757 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler(
3758 ID3D10EffectConstantBuffer *iface)
3760 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3763 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface,
3764 void *data, UINT offset, UINT count)
3766 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3769 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface,
3770 void *data, UINT offset, UINT count)
3772 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3775 /* ID3D10EffectConstantBuffer methods */
3776 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3777 ID3D10Buffer *buffer)
3779 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3781 return E_NOTIMPL;
3784 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface,
3785 ID3D10Buffer **buffer)
3787 FIXME("iface %p, buffer %p stub!\n", iface, buffer);
3789 return E_NOTIMPL;
3792 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3793 ID3D10ShaderResourceView *view)
3795 FIXME("iface %p, view %p stub!\n", iface, view);
3797 return E_NOTIMPL;
3800 static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface,
3801 ID3D10ShaderResourceView **view)
3803 FIXME("iface %p, view %p stub!\n", iface, view);
3805 return E_NOTIMPL;
3808 static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl =
3810 /* ID3D10EffectVariable methods */
3811 d3d10_effect_constant_buffer_IsValid,
3812 d3d10_effect_constant_buffer_GetType,
3813 d3d10_effect_constant_buffer_GetDesc,
3814 d3d10_effect_constant_buffer_GetAnnotationByIndex,
3815 d3d10_effect_constant_buffer_GetAnnotationByName,
3816 d3d10_effect_constant_buffer_GetMemberByIndex,
3817 d3d10_effect_constant_buffer_GetMemberByName,
3818 d3d10_effect_constant_buffer_GetMemberBySemantic,
3819 d3d10_effect_constant_buffer_GetElement,
3820 d3d10_effect_constant_buffer_GetParentConstantBuffer,
3821 d3d10_effect_constant_buffer_AsScalar,
3822 d3d10_effect_constant_buffer_AsVector,
3823 d3d10_effect_constant_buffer_AsMatrix,
3824 d3d10_effect_constant_buffer_AsString,
3825 d3d10_effect_constant_buffer_AsShaderResource,
3826 d3d10_effect_constant_buffer_AsRenderTargetView,
3827 d3d10_effect_constant_buffer_AsDepthStencilView,
3828 d3d10_effect_constant_buffer_AsConstantBuffer,
3829 d3d10_effect_constant_buffer_AsShader,
3830 d3d10_effect_constant_buffer_AsBlend,
3831 d3d10_effect_constant_buffer_AsDepthStencil,
3832 d3d10_effect_constant_buffer_AsRasterizer,
3833 d3d10_effect_constant_buffer_AsSampler,
3834 d3d10_effect_constant_buffer_SetRawValue,
3835 d3d10_effect_constant_buffer_GetRawValue,
3836 /* ID3D10EffectConstantBuffer methods */
3837 d3d10_effect_constant_buffer_SetConstantBuffer,
3838 d3d10_effect_constant_buffer_GetConstantBuffer,
3839 d3d10_effect_constant_buffer_SetTextureBuffer,
3840 d3d10_effect_constant_buffer_GetTextureBuffer,
3843 /* ID3D10EffectVariable methods */
3845 static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
3847 TRACE("iface %p\n", iface);
3849 return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
3852 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
3853 ID3D10EffectScalarVariable *iface)
3855 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
3858 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
3859 D3D10_EFFECT_VARIABLE_DESC *desc)
3861 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
3864 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
3865 ID3D10EffectScalarVariable *iface, UINT index)
3867 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
3870 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
3871 ID3D10EffectScalarVariable *iface, const char *name)
3873 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
3876 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
3877 ID3D10EffectScalarVariable *iface, UINT index)
3879 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
3882 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
3883 ID3D10EffectScalarVariable *iface, const char *name)
3885 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
3888 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
3889 ID3D10EffectScalarVariable *iface, const char *semantic)
3891 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
3894 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
3895 ID3D10EffectScalarVariable *iface, UINT index)
3897 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
3900 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
3901 ID3D10EffectScalarVariable *iface)
3903 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
3906 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
3907 ID3D10EffectScalarVariable *iface)
3909 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
3912 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
3913 ID3D10EffectScalarVariable *iface)
3915 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
3918 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
3919 ID3D10EffectScalarVariable *iface)
3921 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
3924 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
3925 ID3D10EffectScalarVariable *iface)
3927 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
3930 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
3931 ID3D10EffectScalarVariable *iface)
3933 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
3936 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
3937 ID3D10EffectScalarVariable *iface)
3939 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
3942 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
3943 ID3D10EffectScalarVariable *iface)
3945 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
3948 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
3949 ID3D10EffectScalarVariable *iface)
3951 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
3954 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
3955 ID3D10EffectScalarVariable *iface)
3957 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
3960 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
3961 ID3D10EffectScalarVariable *iface)
3963 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
3966 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
3967 ID3D10EffectScalarVariable *iface)
3969 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
3972 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
3973 ID3D10EffectScalarVariable *iface)
3975 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
3978 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
3979 ID3D10EffectScalarVariable *iface)
3981 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
3984 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
3985 void *data, UINT offset, UINT count)
3987 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3990 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
3991 void *data, UINT offset, UINT count)
3993 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
3996 /* ID3D10EffectScalarVariable methods */
3998 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
3999 float value)
4001 FIXME("iface %p, value %.8e stub!\n", iface, value);
4003 return E_NOTIMPL;
4006 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
4007 float *value)
4009 FIXME("iface %p, value %p stub!\n", iface, value);
4011 return E_NOTIMPL;
4014 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
4015 float *values, UINT offset, UINT count)
4017 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4019 return E_NOTIMPL;
4022 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
4023 float *values, UINT offset, UINT count)
4025 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4027 return E_NOTIMPL;
4030 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetInt(ID3D10EffectScalarVariable *iface,
4031 int value)
4033 FIXME("iface %p, value %d stub!\n", iface, value);
4035 return E_NOTIMPL;
4038 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
4039 int *value)
4041 FIXME("iface %p, value %p stub!\n", iface, value);
4043 return E_NOTIMPL;
4046 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
4047 int *values, UINT offset, UINT count)
4049 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4051 return E_NOTIMPL;
4054 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
4055 int *values, UINT offset, UINT count)
4057 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4059 return E_NOTIMPL;
4062 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
4063 BOOL value)
4065 FIXME("iface %p, value %d stub!\n", iface, value);
4067 return E_NOTIMPL;
4070 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
4071 BOOL *value)
4073 FIXME("iface %p, value %p stub!\n", iface, value);
4075 return E_NOTIMPL;
4078 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
4079 BOOL *values, UINT offset, UINT count)
4081 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4083 return E_NOTIMPL;
4086 static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
4087 BOOL *values, UINT offset, UINT count)
4089 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4091 return E_NOTIMPL;
4094 static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
4096 /* ID3D10EffectVariable methods */
4097 d3d10_effect_scalar_variable_IsValid,
4098 d3d10_effect_scalar_variable_GetType,
4099 d3d10_effect_scalar_variable_GetDesc,
4100 d3d10_effect_scalar_variable_GetAnnotationByIndex,
4101 d3d10_effect_scalar_variable_GetAnnotationByName,
4102 d3d10_effect_scalar_variable_GetMemberByIndex,
4103 d3d10_effect_scalar_variable_GetMemberByName,
4104 d3d10_effect_scalar_variable_GetMemberBySemantic,
4105 d3d10_effect_scalar_variable_GetElement,
4106 d3d10_effect_scalar_variable_GetParentConstantBuffer,
4107 d3d10_effect_scalar_variable_AsScalar,
4108 d3d10_effect_scalar_variable_AsVector,
4109 d3d10_effect_scalar_variable_AsMatrix,
4110 d3d10_effect_scalar_variable_AsString,
4111 d3d10_effect_scalar_variable_AsShaderResource,
4112 d3d10_effect_scalar_variable_AsRenderTargetView,
4113 d3d10_effect_scalar_variable_AsDepthStencilView,
4114 d3d10_effect_scalar_variable_AsConstantBuffer,
4115 d3d10_effect_scalar_variable_AsShader,
4116 d3d10_effect_scalar_variable_AsBlend,
4117 d3d10_effect_scalar_variable_AsDepthStencil,
4118 d3d10_effect_scalar_variable_AsRasterizer,
4119 d3d10_effect_scalar_variable_AsSampler,
4120 d3d10_effect_scalar_variable_SetRawValue,
4121 d3d10_effect_scalar_variable_GetRawValue,
4122 /* ID3D10EffectScalarVariable methods */
4123 d3d10_effect_scalar_variable_SetFloat,
4124 d3d10_effect_scalar_variable_GetFloat,
4125 d3d10_effect_scalar_variable_SetFloatArray,
4126 d3d10_effect_scalar_variable_GetFloatArray,
4127 d3d10_effect_scalar_variable_SetInt,
4128 d3d10_effect_scalar_variable_GetInt,
4129 d3d10_effect_scalar_variable_SetIntArray,
4130 d3d10_effect_scalar_variable_GetIntArray,
4131 d3d10_effect_scalar_variable_SetBool,
4132 d3d10_effect_scalar_variable_GetBool,
4133 d3d10_effect_scalar_variable_SetBoolArray,
4134 d3d10_effect_scalar_variable_GetBoolArray,
4137 /* ID3D10EffectVariable methods */
4139 static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
4141 TRACE("iface %p\n", iface);
4143 return (struct d3d10_effect_variable *)iface != &null_vector_variable;
4146 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetType(
4147 ID3D10EffectVectorVariable *iface)
4149 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4152 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetDesc(ID3D10EffectVectorVariable *iface,
4153 D3D10_EFFECT_VARIABLE_DESC *desc)
4155 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4158 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByIndex(
4159 ID3D10EffectVectorVariable *iface, UINT index)
4161 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4164 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetAnnotationByName(
4165 ID3D10EffectVectorVariable *iface, const char *name)
4167 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4170 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByIndex(
4171 ID3D10EffectVectorVariable *iface, UINT index)
4173 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4176 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberByName(
4177 ID3D10EffectVectorVariable *iface, const char *name)
4179 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4182 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetMemberBySemantic(
4183 ID3D10EffectVectorVariable *iface, const char *semantic)
4185 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4188 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetElement(
4189 ID3D10EffectVectorVariable *iface, UINT index)
4191 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4194 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_GetParentConstantBuffer(
4195 ID3D10EffectVectorVariable *iface)
4197 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4200 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsScalar(
4201 ID3D10EffectVectorVariable *iface)
4203 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4206 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsVector(
4207 ID3D10EffectVectorVariable *iface)
4209 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4212 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsMatrix(
4213 ID3D10EffectVectorVariable *iface)
4215 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4218 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsString(
4219 ID3D10EffectVectorVariable *iface)
4221 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4224 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShaderResource(
4225 ID3D10EffectVectorVariable *iface)
4227 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4230 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRenderTargetView(
4231 ID3D10EffectVectorVariable *iface)
4233 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4236 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencilView(
4237 ID3D10EffectVectorVariable *iface)
4239 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4242 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsConstantBuffer(
4243 ID3D10EffectVectorVariable *iface)
4245 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4248 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsShader(
4249 ID3D10EffectVectorVariable *iface)
4251 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4254 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsBlend(
4255 ID3D10EffectVectorVariable *iface)
4257 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4260 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsDepthStencil(
4261 ID3D10EffectVectorVariable *iface)
4263 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4266 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsRasterizer(
4267 ID3D10EffectVectorVariable *iface)
4269 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4272 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_vector_variable_AsSampler(
4273 ID3D10EffectVectorVariable *iface)
4275 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4278 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetRawValue(ID3D10EffectVectorVariable *iface,
4279 void *data, UINT offset, UINT count)
4281 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4284 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetRawValue(ID3D10EffectVectorVariable *iface,
4285 void *data, UINT offset, UINT count)
4287 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4290 /* ID3D10EffectVectorVariable methods */
4292 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVector(ID3D10EffectVectorVariable *iface,
4293 BOOL *value)
4295 FIXME("iface %p, value %p stub!\n", iface, value);
4297 return E_NOTIMPL;
4300 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVector(ID3D10EffectVectorVariable *iface,
4301 int *value)
4303 FIXME("iface %p, value %p stub!\n", iface, value);
4305 return E_NOTIMPL;
4308 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVector(ID3D10EffectVectorVariable *iface,
4309 float *value)
4311 FIXME("iface %p, value %p stub!\n", iface, value);
4313 return E_NOTIMPL;
4316 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVector(ID3D10EffectVectorVariable *iface,
4317 BOOL *value)
4319 FIXME("iface %p, value %p stub!\n", iface, value);
4321 return E_NOTIMPL;
4324 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVector(ID3D10EffectVectorVariable *iface,
4325 int *value)
4327 FIXME("iface %p, value %p stub!\n", iface, value);
4329 return E_NOTIMPL;
4332 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVector(ID3D10EffectVectorVariable *iface,
4333 float *value)
4335 FIXME("iface %p, value %p stub!\n", iface, value);
4337 return E_NOTIMPL;
4340 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4341 BOOL *values, UINT offset, UINT count)
4343 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4345 return E_NOTIMPL;
4348 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetIntVectorArray(ID3D10EffectVectorVariable *iface,
4349 int *values, UINT offset, UINT count)
4351 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4353 return E_NOTIMPL;
4356 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_SetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4357 float *values, UINT offset, UINT count)
4359 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4361 return E_NOTIMPL;
4364 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetBoolVectorArray(ID3D10EffectVectorVariable *iface,
4365 BOOL *values, UINT offset, UINT count)
4367 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4369 return E_NOTIMPL;
4372 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetIntVectorArray(ID3D10EffectVectorVariable *iface,
4373 int *values, UINT offset, UINT count)
4375 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4377 return E_NOTIMPL;
4380 static HRESULT STDMETHODCALLTYPE d3d10_effect_vector_variable_GetFloatVectorArray(ID3D10EffectVectorVariable *iface,
4381 float *values, UINT offset, UINT count)
4383 FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
4385 return E_NOTIMPL;
4388 static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl =
4390 /* ID3D10EffectVariable methods */
4391 d3d10_effect_vector_variable_IsValid,
4392 d3d10_effect_vector_variable_GetType,
4393 d3d10_effect_vector_variable_GetDesc,
4394 d3d10_effect_vector_variable_GetAnnotationByIndex,
4395 d3d10_effect_vector_variable_GetAnnotationByName,
4396 d3d10_effect_vector_variable_GetMemberByIndex,
4397 d3d10_effect_vector_variable_GetMemberByName,
4398 d3d10_effect_vector_variable_GetMemberBySemantic,
4399 d3d10_effect_vector_variable_GetElement,
4400 d3d10_effect_vector_variable_GetParentConstantBuffer,
4401 d3d10_effect_vector_variable_AsScalar,
4402 d3d10_effect_vector_variable_AsVector,
4403 d3d10_effect_vector_variable_AsMatrix,
4404 d3d10_effect_vector_variable_AsString,
4405 d3d10_effect_vector_variable_AsShaderResource,
4406 d3d10_effect_vector_variable_AsRenderTargetView,
4407 d3d10_effect_vector_variable_AsDepthStencilView,
4408 d3d10_effect_vector_variable_AsConstantBuffer,
4409 d3d10_effect_vector_variable_AsShader,
4410 d3d10_effect_vector_variable_AsBlend,
4411 d3d10_effect_vector_variable_AsDepthStencil,
4412 d3d10_effect_vector_variable_AsRasterizer,
4413 d3d10_effect_vector_variable_AsSampler,
4414 d3d10_effect_vector_variable_SetRawValue,
4415 d3d10_effect_vector_variable_GetRawValue,
4416 /* ID3D10EffectVectorVariable methods */
4417 d3d10_effect_vector_variable_SetBoolVector,
4418 d3d10_effect_vector_variable_SetIntVector,
4419 d3d10_effect_vector_variable_SetFloatVector,
4420 d3d10_effect_vector_variable_GetBoolVector,
4421 d3d10_effect_vector_variable_GetIntVector,
4422 d3d10_effect_vector_variable_GetFloatVector,
4423 d3d10_effect_vector_variable_SetBoolVectorArray,
4424 d3d10_effect_vector_variable_SetIntVectorArray,
4425 d3d10_effect_vector_variable_SetFloatVectorArray,
4426 d3d10_effect_vector_variable_GetBoolVectorArray,
4427 d3d10_effect_vector_variable_GetIntVectorArray,
4428 d3d10_effect_vector_variable_GetFloatVectorArray,
4431 /* ID3D10EffectVariable methods */
4433 static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
4435 TRACE("iface %p\n", iface);
4437 return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
4440 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
4441 ID3D10EffectMatrixVariable *iface)
4443 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4446 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
4447 D3D10_EFFECT_VARIABLE_DESC *desc)
4449 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4452 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
4453 ID3D10EffectMatrixVariable *iface, UINT index)
4455 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4458 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
4459 ID3D10EffectMatrixVariable *iface, const char *name)
4461 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4464 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
4465 ID3D10EffectMatrixVariable *iface, UINT index)
4467 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4470 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
4471 ID3D10EffectMatrixVariable *iface, const char *name)
4473 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4476 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
4477 ID3D10EffectMatrixVariable *iface, const char *semantic)
4479 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4482 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
4483 ID3D10EffectMatrixVariable *iface, UINT index)
4485 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4488 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
4489 ID3D10EffectMatrixVariable *iface)
4491 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4494 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
4495 ID3D10EffectMatrixVariable *iface)
4497 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4500 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
4501 ID3D10EffectMatrixVariable *iface)
4503 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4506 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
4507 ID3D10EffectMatrixVariable *iface)
4509 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4512 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
4513 ID3D10EffectMatrixVariable *iface)
4515 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4518 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
4519 ID3D10EffectMatrixVariable *iface)
4521 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4524 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
4525 ID3D10EffectMatrixVariable *iface)
4527 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4530 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
4531 ID3D10EffectMatrixVariable *iface)
4533 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4536 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
4537 ID3D10EffectMatrixVariable *iface)
4539 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4542 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
4543 ID3D10EffectMatrixVariable *iface)
4545 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4548 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
4549 ID3D10EffectMatrixVariable *iface)
4551 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4554 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
4555 ID3D10EffectMatrixVariable *iface)
4557 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4560 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
4561 ID3D10EffectMatrixVariable *iface)
4563 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4566 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
4567 ID3D10EffectMatrixVariable *iface)
4569 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4572 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
4573 void *data, UINT offset, UINT count)
4575 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4578 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
4579 void *data, UINT offset, UINT count)
4581 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4584 /* ID3D10EffectMatrixVariable methods */
4586 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
4587 float *data)
4589 FIXME("iface %p, data %p stub!\n", iface, data);
4591 return E_NOTIMPL;
4594 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
4595 float *data)
4597 FIXME("iface %p, data %p stub!\n", iface, data);
4599 return E_NOTIMPL;
4602 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
4603 float *data, UINT offset, UINT count)
4605 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4607 return E_NOTIMPL;
4610 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
4611 float *data, UINT offset, UINT count)
4613 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4615 return E_NOTIMPL;
4618 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4619 float *data)
4621 FIXME("iface %p, data %p stub!\n", iface, data);
4623 return E_NOTIMPL;
4626 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
4627 float *data)
4629 FIXME("iface %p, data %p stub!\n", iface, data);
4631 return E_NOTIMPL;
4634 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4635 float *data, UINT offset, UINT count)
4637 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4639 return E_NOTIMPL;
4642 static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
4643 float *data, UINT offset, UINT count)
4645 FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
4647 return E_NOTIMPL;
4651 static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
4653 /* ID3D10EffectVariable methods */
4654 d3d10_effect_matrix_variable_IsValid,
4655 d3d10_effect_matrix_variable_GetType,
4656 d3d10_effect_matrix_variable_GetDesc,
4657 d3d10_effect_matrix_variable_GetAnnotationByIndex,
4658 d3d10_effect_matrix_variable_GetAnnotationByName,
4659 d3d10_effect_matrix_variable_GetMemberByIndex,
4660 d3d10_effect_matrix_variable_GetMemberByName,
4661 d3d10_effect_matrix_variable_GetMemberBySemantic,
4662 d3d10_effect_matrix_variable_GetElement,
4663 d3d10_effect_matrix_variable_GetParentConstantBuffer,
4664 d3d10_effect_matrix_variable_AsScalar,
4665 d3d10_effect_matrix_variable_AsVector,
4666 d3d10_effect_matrix_variable_AsMatrix,
4667 d3d10_effect_matrix_variable_AsString,
4668 d3d10_effect_matrix_variable_AsShaderResource,
4669 d3d10_effect_matrix_variable_AsRenderTargetView,
4670 d3d10_effect_matrix_variable_AsDepthStencilView,
4671 d3d10_effect_matrix_variable_AsConstantBuffer,
4672 d3d10_effect_matrix_variable_AsShader,
4673 d3d10_effect_matrix_variable_AsBlend,
4674 d3d10_effect_matrix_variable_AsDepthStencil,
4675 d3d10_effect_matrix_variable_AsRasterizer,
4676 d3d10_effect_matrix_variable_AsSampler,
4677 d3d10_effect_matrix_variable_SetRawValue,
4678 d3d10_effect_matrix_variable_GetRawValue,
4679 /* ID3D10EffectMatrixVariable methods */
4680 d3d10_effect_matrix_variable_SetMatrix,
4681 d3d10_effect_matrix_variable_GetMatrix,
4682 d3d10_effect_matrix_variable_SetMatrixArray,
4683 d3d10_effect_matrix_variable_GetMatrixArray,
4684 d3d10_effect_matrix_variable_SetMatrixTranspose,
4685 d3d10_effect_matrix_variable_GetMatrixTranspose,
4686 d3d10_effect_matrix_variable_SetMatrixTransposeArray,
4687 d3d10_effect_matrix_variable_GetMatrixTransposeArray,
4690 /* ID3D10EffectVariable methods */
4692 static BOOL STDMETHODCALLTYPE d3d10_effect_string_variable_IsValid(ID3D10EffectStringVariable *iface)
4694 TRACE("iface %p\n", iface);
4696 return (struct d3d10_effect_variable *)iface != &null_string_variable;
4699 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_string_variable_GetType(
4700 ID3D10EffectStringVariable *iface)
4702 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4705 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetDesc(ID3D10EffectStringVariable *iface,
4706 D3D10_EFFECT_VARIABLE_DESC *desc)
4708 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4711 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByIndex(
4712 ID3D10EffectStringVariable *iface, UINT index)
4714 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4717 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetAnnotationByName(
4718 ID3D10EffectStringVariable *iface, const char *name)
4720 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4723 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByIndex(
4724 ID3D10EffectStringVariable *iface, UINT index)
4726 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4729 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberByName(
4730 ID3D10EffectStringVariable *iface, const char *name)
4732 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4735 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetMemberBySemantic(
4736 ID3D10EffectStringVariable *iface, const char *semantic)
4738 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4741 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_GetElement(
4742 ID3D10EffectStringVariable *iface, UINT index)
4744 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4747 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_GetParentConstantBuffer(
4748 ID3D10EffectStringVariable *iface)
4750 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4753 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsScalar(
4754 ID3D10EffectStringVariable *iface)
4756 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4759 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsVector(
4760 ID3D10EffectStringVariable *iface)
4762 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4765 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsMatrix(
4766 ID3D10EffectStringVariable *iface)
4768 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4771 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsString(
4772 ID3D10EffectStringVariable *iface)
4774 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4777 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShaderResource(
4778 ID3D10EffectStringVariable *iface)
4780 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4783 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRenderTargetView(
4784 ID3D10EffectStringVariable *iface)
4786 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4789 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencilView(
4790 ID3D10EffectStringVariable *iface)
4792 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
4795 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_string_variable_AsConstantBuffer(
4796 ID3D10EffectStringVariable *iface)
4798 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
4801 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsShader(
4802 ID3D10EffectStringVariable *iface)
4804 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
4807 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsBlend(
4808 ID3D10EffectStringVariable *iface)
4810 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
4813 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsDepthStencil(
4814 ID3D10EffectStringVariable *iface)
4816 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
4819 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsRasterizer(
4820 ID3D10EffectStringVariable *iface)
4822 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
4825 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_string_variable_AsSampler(
4826 ID3D10EffectStringVariable *iface)
4828 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
4831 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_SetRawValue(ID3D10EffectStringVariable *iface,
4832 void *data, UINT offset, UINT count)
4834 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4837 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetRawValue(ID3D10EffectStringVariable *iface,
4838 void *data, UINT offset, UINT count)
4840 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
4843 /* ID3D10EffectStringVariable methods */
4845 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetString(ID3D10EffectStringVariable *iface,
4846 const char **str)
4848 FIXME("iface %p, str %p stub!\n", iface, str);
4850 return E_NOTIMPL;
4853 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetStringArray(ID3D10EffectStringVariable *iface,
4854 const char **strs, UINT offset, UINT count)
4856 FIXME("iface %p, strs %p, offset %u, count %u stub!\n", iface, strs, offset, count);
4858 return E_NOTIMPL;
4862 static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_vtbl =
4864 /* ID3D10EffectVariable methods */
4865 d3d10_effect_string_variable_IsValid,
4866 d3d10_effect_string_variable_GetType,
4867 d3d10_effect_string_variable_GetDesc,
4868 d3d10_effect_string_variable_GetAnnotationByIndex,
4869 d3d10_effect_string_variable_GetAnnotationByName,
4870 d3d10_effect_string_variable_GetMemberByIndex,
4871 d3d10_effect_string_variable_GetMemberByName,
4872 d3d10_effect_string_variable_GetMemberBySemantic,
4873 d3d10_effect_string_variable_GetElement,
4874 d3d10_effect_string_variable_GetParentConstantBuffer,
4875 d3d10_effect_string_variable_AsScalar,
4876 d3d10_effect_string_variable_AsVector,
4877 d3d10_effect_string_variable_AsMatrix,
4878 d3d10_effect_string_variable_AsString,
4879 d3d10_effect_string_variable_AsShaderResource,
4880 d3d10_effect_string_variable_AsRenderTargetView,
4881 d3d10_effect_string_variable_AsDepthStencilView,
4882 d3d10_effect_string_variable_AsConstantBuffer,
4883 d3d10_effect_string_variable_AsShader,
4884 d3d10_effect_string_variable_AsBlend,
4885 d3d10_effect_string_variable_AsDepthStencil,
4886 d3d10_effect_string_variable_AsRasterizer,
4887 d3d10_effect_string_variable_AsSampler,
4888 d3d10_effect_string_variable_SetRawValue,
4889 d3d10_effect_string_variable_GetRawValue,
4890 /* ID3D10EffectStringVariable methods */
4891 d3d10_effect_string_variable_GetString,
4892 d3d10_effect_string_variable_GetStringArray,
4895 /* ID3D10EffectVariable methods */
4897 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_IsValid(ID3D10EffectShaderResourceVariable *iface)
4899 TRACE("iface %p\n", iface);
4901 return (struct d3d10_effect_variable *)iface != &null_shader_resource_variable;
4904 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetType(
4905 ID3D10EffectShaderResourceVariable *iface)
4907 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
4910 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetDesc(
4911 ID3D10EffectShaderResourceVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
4913 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
4916 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByIndex(
4917 ID3D10EffectShaderResourceVariable *iface, UINT index)
4919 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
4922 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetAnnotationByName(
4923 ID3D10EffectShaderResourceVariable *iface, const char *name)
4925 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
4928 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByIndex(
4929 ID3D10EffectShaderResourceVariable *iface, UINT index)
4931 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
4934 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberByName(
4935 ID3D10EffectShaderResourceVariable *iface, const char *name)
4937 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
4940 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetMemberBySemantic(
4941 ID3D10EffectShaderResourceVariable *iface, const char *semantic)
4943 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
4946 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetElement(
4947 ID3D10EffectShaderResourceVariable *iface, UINT index)
4949 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
4952 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetParentConstantBuffer(
4953 ID3D10EffectShaderResourceVariable *iface)
4955 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
4958 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsScalar(
4959 ID3D10EffectShaderResourceVariable *iface)
4961 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
4964 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsVector(
4965 ID3D10EffectShaderResourceVariable *iface)
4967 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
4970 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsMatrix(
4971 ID3D10EffectShaderResourceVariable *iface)
4973 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
4976 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsString(
4977 ID3D10EffectShaderResourceVariable *iface)
4979 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
4982 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShaderResource(
4983 ID3D10EffectShaderResourceVariable *iface)
4985 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
4988 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRenderTargetView(
4989 ID3D10EffectShaderResourceVariable *iface)
4991 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
4994 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencilView(
4995 ID3D10EffectShaderResourceVariable *iface)
4997 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5000 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsConstantBuffer(
5001 ID3D10EffectShaderResourceVariable *iface)
5003 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5006 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsShader(
5007 ID3D10EffectShaderResourceVariable *iface)
5009 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5012 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsBlend(
5013 ID3D10EffectShaderResourceVariable *iface)
5015 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5018 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsDepthStencil(
5019 ID3D10EffectShaderResourceVariable *iface)
5021 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5024 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsRasterizer(
5025 ID3D10EffectShaderResourceVariable *iface)
5027 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5030 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_AsSampler(
5031 ID3D10EffectShaderResourceVariable *iface)
5033 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5036 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetRawValue(
5037 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
5039 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5042 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetRawValue(
5043 ID3D10EffectShaderResourceVariable *iface, void *data, UINT offset, UINT count)
5045 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5048 /* ID3D10EffectShaderResourceVariable methods */
5050 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResource(
5051 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView *resource)
5053 FIXME("iface %p, resource %p stub!\n", iface, resource);
5055 return E_NOTIMPL;
5058 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResource(
5059 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resource)
5061 FIXME("iface %p, resource %p stub!\n", iface, resource);
5063 return E_NOTIMPL;
5066 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_SetResourceArray(
5067 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5069 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5071 return E_NOTIMPL;
5074 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_resource_variable_GetResourceArray(
5075 ID3D10EffectShaderResourceVariable *iface, ID3D10ShaderResourceView **resources, UINT offset, UINT count)
5077 FIXME("iface %p, resources %p, offset %u, count %u stub!\n", iface, resources, offset, count);
5079 return E_NOTIMPL;
5083 static const struct ID3D10EffectShaderResourceVariableVtbl d3d10_effect_shader_resource_variable_vtbl =
5085 /* ID3D10EffectVariable methods */
5086 d3d10_effect_shader_resource_variable_IsValid,
5087 d3d10_effect_shader_resource_variable_GetType,
5088 d3d10_effect_shader_resource_variable_GetDesc,
5089 d3d10_effect_shader_resource_variable_GetAnnotationByIndex,
5090 d3d10_effect_shader_resource_variable_GetAnnotationByName,
5091 d3d10_effect_shader_resource_variable_GetMemberByIndex,
5092 d3d10_effect_shader_resource_variable_GetMemberByName,
5093 d3d10_effect_shader_resource_variable_GetMemberBySemantic,
5094 d3d10_effect_shader_resource_variable_GetElement,
5095 d3d10_effect_shader_resource_variable_GetParentConstantBuffer,
5096 d3d10_effect_shader_resource_variable_AsScalar,
5097 d3d10_effect_shader_resource_variable_AsVector,
5098 d3d10_effect_shader_resource_variable_AsMatrix,
5099 d3d10_effect_shader_resource_variable_AsString,
5100 d3d10_effect_shader_resource_variable_AsShaderResource,
5101 d3d10_effect_shader_resource_variable_AsRenderTargetView,
5102 d3d10_effect_shader_resource_variable_AsDepthStencilView,
5103 d3d10_effect_shader_resource_variable_AsConstantBuffer,
5104 d3d10_effect_shader_resource_variable_AsShader,
5105 d3d10_effect_shader_resource_variable_AsBlend,
5106 d3d10_effect_shader_resource_variable_AsDepthStencil,
5107 d3d10_effect_shader_resource_variable_AsRasterizer,
5108 d3d10_effect_shader_resource_variable_AsSampler,
5109 d3d10_effect_shader_resource_variable_SetRawValue,
5110 d3d10_effect_shader_resource_variable_GetRawValue,
5111 /* ID3D10EffectShaderResourceVariable methods */
5112 d3d10_effect_shader_resource_variable_SetResource,
5113 d3d10_effect_shader_resource_variable_GetResource,
5114 d3d10_effect_shader_resource_variable_SetResourceArray,
5115 d3d10_effect_shader_resource_variable_GetResourceArray,
5118 /* ID3D10EffectVariable methods */
5120 static BOOL STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_IsValid(
5121 ID3D10EffectRenderTargetViewVariable *iface)
5123 TRACE("iface %p\n", iface);
5125 return (struct d3d10_effect_variable *)iface != &null_render_target_view_variable;
5128 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetType(
5129 ID3D10EffectRenderTargetViewVariable *iface)
5131 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5134 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetDesc(
5135 ID3D10EffectRenderTargetViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5137 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5140 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByIndex(
5141 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5143 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5146 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetAnnotationByName(
5147 ID3D10EffectRenderTargetViewVariable *iface, const char *name)
5149 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5152 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByIndex(
5153 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5155 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5158 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberByName(
5159 ID3D10EffectRenderTargetViewVariable *iface, const char *name)
5161 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5164 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetMemberBySemantic(
5165 ID3D10EffectRenderTargetViewVariable *iface, const char *semantic)
5167 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5170 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetElement(
5171 ID3D10EffectRenderTargetViewVariable *iface, UINT index)
5173 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5176 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetParentConstantBuffer(
5177 ID3D10EffectRenderTargetViewVariable *iface)
5179 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5182 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsScalar(
5183 ID3D10EffectRenderTargetViewVariable *iface)
5185 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5188 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsVector(
5189 ID3D10EffectRenderTargetViewVariable *iface)
5191 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5194 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsMatrix(
5195 ID3D10EffectRenderTargetViewVariable *iface)
5197 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5200 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsString(
5201 ID3D10EffectRenderTargetViewVariable *iface)
5203 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5206 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShaderResource(
5207 ID3D10EffectRenderTargetViewVariable *iface)
5209 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5212 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRenderTargetView(
5213 ID3D10EffectRenderTargetViewVariable *iface)
5215 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5218 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencilView(
5219 ID3D10EffectRenderTargetViewVariable *iface)
5221 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5224 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsConstantBuffer(
5225 ID3D10EffectRenderTargetViewVariable *iface)
5227 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5230 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsShader(
5231 ID3D10EffectRenderTargetViewVariable *iface)
5233 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5236 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsBlend(
5237 ID3D10EffectRenderTargetViewVariable *iface)
5239 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5242 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsDepthStencil(
5243 ID3D10EffectRenderTargetViewVariable *iface)
5245 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5248 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsRasterizer(
5249 ID3D10EffectRenderTargetViewVariable *iface)
5251 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5254 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_AsSampler(
5255 ID3D10EffectRenderTargetViewVariable *iface)
5257 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5260 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRawValue(
5261 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5263 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5266 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRawValue(
5267 ID3D10EffectRenderTargetViewVariable *iface, void *data, UINT offset, UINT count)
5269 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5272 /* ID3D10EffectRenderTargetViewVariable methods */
5274 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTarget(
5275 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView *view)
5277 FIXME("iface %p, view %p stub!\n", iface, view);
5279 return E_NOTIMPL;
5282 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTarget(
5283 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **view)
5285 FIXME("iface %p, view %p stub!\n", iface, view);
5287 return E_NOTIMPL;
5290 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_SetRenderTargetArray(
5291 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5293 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5295 return E_NOTIMPL;
5298 static HRESULT STDMETHODCALLTYPE d3d10_effect_render_target_view_variable_GetRenderTargetArray(
5299 ID3D10EffectRenderTargetViewVariable *iface, ID3D10RenderTargetView **views, UINT offset, UINT count)
5301 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5303 return E_NOTIMPL;
5307 static const struct ID3D10EffectRenderTargetViewVariableVtbl d3d10_effect_render_target_view_variable_vtbl =
5309 /* ID3D10EffectVariable methods */
5310 d3d10_effect_render_target_view_variable_IsValid,
5311 d3d10_effect_render_target_view_variable_GetType,
5312 d3d10_effect_render_target_view_variable_GetDesc,
5313 d3d10_effect_render_target_view_variable_GetAnnotationByIndex,
5314 d3d10_effect_render_target_view_variable_GetAnnotationByName,
5315 d3d10_effect_render_target_view_variable_GetMemberByIndex,
5316 d3d10_effect_render_target_view_variable_GetMemberByName,
5317 d3d10_effect_render_target_view_variable_GetMemberBySemantic,
5318 d3d10_effect_render_target_view_variable_GetElement,
5319 d3d10_effect_render_target_view_variable_GetParentConstantBuffer,
5320 d3d10_effect_render_target_view_variable_AsScalar,
5321 d3d10_effect_render_target_view_variable_AsVector,
5322 d3d10_effect_render_target_view_variable_AsMatrix,
5323 d3d10_effect_render_target_view_variable_AsString,
5324 d3d10_effect_render_target_view_variable_AsShaderResource,
5325 d3d10_effect_render_target_view_variable_AsRenderTargetView,
5326 d3d10_effect_render_target_view_variable_AsDepthStencilView,
5327 d3d10_effect_render_target_view_variable_AsConstantBuffer,
5328 d3d10_effect_render_target_view_variable_AsShader,
5329 d3d10_effect_render_target_view_variable_AsBlend,
5330 d3d10_effect_render_target_view_variable_AsDepthStencil,
5331 d3d10_effect_render_target_view_variable_AsRasterizer,
5332 d3d10_effect_render_target_view_variable_AsSampler,
5333 d3d10_effect_render_target_view_variable_SetRawValue,
5334 d3d10_effect_render_target_view_variable_GetRawValue,
5335 /* ID3D10EffectRenderTargetViewVariable methods */
5336 d3d10_effect_render_target_view_variable_SetRenderTarget,
5337 d3d10_effect_render_target_view_variable_GetRenderTarget,
5338 d3d10_effect_render_target_view_variable_SetRenderTargetArray,
5339 d3d10_effect_render_target_view_variable_GetRenderTargetArray,
5342 /* ID3D10EffectVariable methods */
5344 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_IsValid(
5345 ID3D10EffectDepthStencilViewVariable *iface)
5347 TRACE("iface %p\n", iface);
5349 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_view_variable;
5352 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetType(
5353 ID3D10EffectDepthStencilViewVariable *iface)
5355 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5358 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDesc(
5359 ID3D10EffectDepthStencilViewVariable *iface, D3D10_EFFECT_VARIABLE_DESC *desc)
5361 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5364 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex(
5365 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5367 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5370 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetAnnotationByName(
5371 ID3D10EffectDepthStencilViewVariable *iface, const char *name)
5373 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5376 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByIndex(
5377 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5379 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5382 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberByName(
5383 ID3D10EffectDepthStencilViewVariable *iface, const char *name)
5385 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5388 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic(
5389 ID3D10EffectDepthStencilViewVariable *iface, const char *semantic)
5391 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5394 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetElement(
5395 ID3D10EffectDepthStencilViewVariable *iface, UINT index)
5397 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5400 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer(
5401 ID3D10EffectDepthStencilViewVariable *iface)
5403 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5406 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsScalar(
5407 ID3D10EffectDepthStencilViewVariable *iface)
5409 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5412 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsVector(
5413 ID3D10EffectDepthStencilViewVariable *iface)
5415 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5418 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsMatrix(
5419 ID3D10EffectDepthStencilViewVariable *iface)
5421 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5424 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsString(
5425 ID3D10EffectDepthStencilViewVariable *iface)
5427 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5430 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShaderResource(
5431 ID3D10EffectDepthStencilViewVariable *iface)
5433 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5436 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRenderTargetView(
5437 ID3D10EffectDepthStencilViewVariable *iface)
5439 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5442 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencilView(
5443 ID3D10EffectDepthStencilViewVariable *iface)
5445 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5448 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsConstantBuffer(
5449 ID3D10EffectDepthStencilViewVariable *iface)
5451 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5454 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsShader(
5455 ID3D10EffectDepthStencilViewVariable *iface)
5457 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5460 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsBlend(
5461 ID3D10EffectDepthStencilViewVariable *iface)
5463 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5466 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsDepthStencil(
5467 ID3D10EffectDepthStencilViewVariable *iface)
5469 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5472 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsRasterizer(
5473 ID3D10EffectDepthStencilViewVariable *iface)
5475 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5478 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_AsSampler(
5479 ID3D10EffectDepthStencilViewVariable *iface)
5481 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5484 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetRawValue(
5485 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5487 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5490 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetRawValue(
5491 ID3D10EffectDepthStencilViewVariable *iface, void *data, UINT offset, UINT count)
5493 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5496 /* ID3D10EffectDepthStencilViewVariable methods */
5498 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencil(
5499 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView *view)
5501 FIXME("iface %p, view %p stub!\n", iface, view);
5503 return E_NOTIMPL;
5506 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencil(
5507 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **view)
5509 FIXME("iface %p, view %p stub!\n", iface, view);
5511 return E_NOTIMPL;
5514 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray(
5515 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5517 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5519 return E_NOTIMPL;
5522 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray(
5523 ID3D10EffectDepthStencilViewVariable *iface, ID3D10DepthStencilView **views, UINT offset, UINT count)
5525 FIXME("iface %p, views %p, offset %u, count %u stub!\n", iface, views, offset, count);
5527 return E_NOTIMPL;
5531 static const struct ID3D10EffectDepthStencilViewVariableVtbl d3d10_effect_depth_stencil_view_variable_vtbl =
5533 /* ID3D10EffectVariable methods */
5534 d3d10_effect_depth_stencil_view_variable_IsValid,
5535 d3d10_effect_depth_stencil_view_variable_GetType,
5536 d3d10_effect_depth_stencil_view_variable_GetDesc,
5537 d3d10_effect_depth_stencil_view_variable_GetAnnotationByIndex,
5538 d3d10_effect_depth_stencil_view_variable_GetAnnotationByName,
5539 d3d10_effect_depth_stencil_view_variable_GetMemberByIndex,
5540 d3d10_effect_depth_stencil_view_variable_GetMemberByName,
5541 d3d10_effect_depth_stencil_view_variable_GetMemberBySemantic,
5542 d3d10_effect_depth_stencil_view_variable_GetElement,
5543 d3d10_effect_depth_stencil_view_variable_GetParentConstantBuffer,
5544 d3d10_effect_depth_stencil_view_variable_AsScalar,
5545 d3d10_effect_depth_stencil_view_variable_AsVector,
5546 d3d10_effect_depth_stencil_view_variable_AsMatrix,
5547 d3d10_effect_depth_stencil_view_variable_AsString,
5548 d3d10_effect_depth_stencil_view_variable_AsShaderResource,
5549 d3d10_effect_depth_stencil_view_variable_AsRenderTargetView,
5550 d3d10_effect_depth_stencil_view_variable_AsDepthStencilView,
5551 d3d10_effect_depth_stencil_view_variable_AsConstantBuffer,
5552 d3d10_effect_depth_stencil_view_variable_AsShader,
5553 d3d10_effect_depth_stencil_view_variable_AsBlend,
5554 d3d10_effect_depth_stencil_view_variable_AsDepthStencil,
5555 d3d10_effect_depth_stencil_view_variable_AsRasterizer,
5556 d3d10_effect_depth_stencil_view_variable_AsSampler,
5557 d3d10_effect_depth_stencil_view_variable_SetRawValue,
5558 d3d10_effect_depth_stencil_view_variable_GetRawValue,
5559 /* ID3D10EffectDepthStencilViewVariable methods */
5560 d3d10_effect_depth_stencil_view_variable_SetDepthStencil,
5561 d3d10_effect_depth_stencil_view_variable_GetDepthStencil,
5562 d3d10_effect_depth_stencil_view_variable_SetDepthStencilArray,
5563 d3d10_effect_depth_stencil_view_variable_GetDepthStencilArray,
5566 /* ID3D10EffectVariable methods */
5568 static BOOL STDMETHODCALLTYPE d3d10_effect_shader_variable_IsValid(ID3D10EffectShaderVariable *iface)
5570 TRACE("iface %p\n", iface);
5572 return (struct d3d10_effect_variable *)iface != &null_shader_variable;
5575 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetType(
5576 ID3D10EffectShaderVariable *iface)
5578 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5581 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetDesc(ID3D10EffectShaderVariable *iface,
5582 D3D10_EFFECT_VARIABLE_DESC *desc)
5584 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5587 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByIndex(
5588 ID3D10EffectShaderVariable *iface, UINT index)
5590 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5593 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetAnnotationByName(
5594 ID3D10EffectShaderVariable *iface, const char *name)
5596 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5599 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByIndex(
5600 ID3D10EffectShaderVariable *iface, UINT index)
5602 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5605 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberByName(
5606 ID3D10EffectShaderVariable *iface, const char *name)
5608 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5611 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetMemberBySemantic(
5612 ID3D10EffectShaderVariable *iface, const char *semantic)
5614 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5617 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetElement(
5618 ID3D10EffectShaderVariable *iface, UINT index)
5620 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
5623 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_GetParentConstantBuffer(
5624 ID3D10EffectShaderVariable *iface)
5626 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
5629 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsScalar(
5630 ID3D10EffectShaderVariable *iface)
5632 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
5635 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsVector(
5636 ID3D10EffectShaderVariable *iface)
5638 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
5641 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsMatrix(
5642 ID3D10EffectShaderVariable *iface)
5644 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
5647 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsString(
5648 ID3D10EffectShaderVariable *iface)
5650 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
5653 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShaderResource(
5654 ID3D10EffectShaderVariable *iface)
5656 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
5659 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRenderTargetView(
5660 ID3D10EffectShaderVariable *iface)
5662 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
5665 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencilView(
5666 ID3D10EffectShaderVariable *iface)
5668 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
5671 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsConstantBuffer(
5672 ID3D10EffectShaderVariable *iface)
5674 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
5677 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsShader(
5678 ID3D10EffectShaderVariable *iface)
5680 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
5683 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsBlend(
5684 ID3D10EffectShaderVariable *iface)
5686 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
5689 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsDepthStencil(
5690 ID3D10EffectShaderVariable *iface)
5692 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
5695 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsRasterizer(
5696 ID3D10EffectShaderVariable *iface)
5698 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
5701 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_shader_variable_AsSampler(
5702 ID3D10EffectShaderVariable *iface)
5704 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
5707 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_SetRawValue(
5708 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5710 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5713 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetRawValue(
5714 ID3D10EffectShaderVariable *iface, void *data, UINT offset, UINT count)
5716 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
5719 /* ID3D10EffectShaderVariable methods */
5721 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetShaderDesc(
5722 ID3D10EffectShaderVariable *iface, UINT index, D3D10_EFFECT_SHADER_DESC *desc)
5724 FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc);
5726 return E_NOTIMPL;
5729 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetVertexShader(
5730 ID3D10EffectShaderVariable *iface, UINT index, ID3D10VertexShader **shader)
5732 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5734 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5736 if (v->type->element_count)
5737 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5739 if (v->type->basetype != D3D10_SVT_VERTEXSHADER)
5741 WARN("Shader is not a vertex shader.\n");
5742 return E_FAIL;
5745 if ((*shader = v->u.shader.shader.vs))
5746 ID3D10VertexShader_AddRef(*shader);
5748 return S_OK;
5751 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetGeometryShader(
5752 ID3D10EffectShaderVariable *iface, UINT index, ID3D10GeometryShader **shader)
5754 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5756 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5758 if (v->type->element_count)
5759 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5761 if (v->type->basetype != D3D10_SVT_GEOMETRYSHADER)
5763 WARN("Shader is not a geometry shader.\n");
5764 return E_FAIL;
5767 if ((*shader = v->u.shader.shader.gs))
5768 ID3D10GeometryShader_AddRef(*shader);
5770 return S_OK;
5773 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetPixelShader(
5774 ID3D10EffectShaderVariable *iface, UINT index, ID3D10PixelShader **shader)
5776 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
5778 TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
5780 if (v->type->element_count)
5781 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
5783 if (v->type->basetype != D3D10_SVT_PIXELSHADER)
5785 WARN("Shader is not a pixel shader.\n");
5786 return E_FAIL;
5789 if ((*shader = v->u.shader.shader.ps))
5790 ID3D10PixelShader_AddRef(*shader);
5792 return S_OK;
5795 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetInputSignatureElementDesc(
5796 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5797 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5799 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5800 struct d3d10_effect_shader_variable *s;
5801 D3D10_SIGNATURE_PARAMETER_DESC *d;
5803 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5804 iface, shader_index, element_index, desc);
5806 if (!iface->lpVtbl->IsValid(iface))
5808 WARN("Null variable specified\n");
5809 return E_FAIL;
5812 /* Check shader_index, this crashes on W7/DX10 */
5813 if (shader_index >= This->effect->used_shader_count)
5815 WARN("This should crash on W7/DX10!\n");
5816 return E_FAIL;
5819 s = &This->effect->used_shaders[shader_index]->u.shader;
5820 if (!s->input_signature.signature)
5822 WARN("No shader signature\n");
5823 return D3DERR_INVALIDCALL;
5826 /* Check desc for NULL, this crashes on W7/DX10 */
5827 if (!desc)
5829 WARN("This should crash on W7/DX10!\n");
5830 return E_FAIL;
5833 if (element_index >= s->input_signature.element_count)
5835 WARN("Invalid element index specified\n");
5836 return E_INVALIDARG;
5839 d = &s->input_signature.elements[element_index];
5840 desc->SemanticName = d->SemanticName;
5841 desc->SemanticIndex = d->SemanticIndex;
5842 desc->SystemValueType = d->SystemValueType;
5843 desc->ComponentType = d->ComponentType;
5844 desc->Register = d->Register;
5845 desc->ReadWriteMask = d->ReadWriteMask;
5846 desc->Mask = d->Mask;
5848 return S_OK;
5851 static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetOutputSignatureElementDesc(
5852 ID3D10EffectShaderVariable *iface, UINT shader_index, UINT element_index,
5853 D3D10_SIGNATURE_PARAMETER_DESC *desc)
5855 struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
5856 struct d3d10_effect_shader_variable *s;
5857 D3D10_SIGNATURE_PARAMETER_DESC *d;
5859 TRACE("iface %p, shader_index %u, element_index %u, desc %p\n",
5860 iface, shader_index, element_index, desc);
5862 if (!iface->lpVtbl->IsValid(iface))
5864 WARN("Null variable specified\n");
5865 return E_FAIL;
5868 /* Check shader_index, this crashes on W7/DX10 */
5869 if (shader_index >= This->effect->used_shader_count)
5871 WARN("This should crash on W7/DX10!\n");
5872 return E_FAIL;
5875 s = &This->effect->used_shaders[shader_index]->u.shader;
5876 if (!s->output_signature.signature)
5878 WARN("No shader signature\n");
5879 return D3DERR_INVALIDCALL;
5882 /* Check desc for NULL, this crashes on W7/DX10 */
5883 if (!desc)
5885 WARN("This should crash on W7/DX10!\n");
5886 return E_FAIL;
5889 if (element_index >= s->output_signature.element_count)
5891 WARN("Invalid element index specified\n");
5892 return E_INVALIDARG;
5895 d = &s->output_signature.elements[element_index];
5896 desc->SemanticName = d->SemanticName;
5897 desc->SemanticIndex = d->SemanticIndex;
5898 desc->SystemValueType = d->SystemValueType;
5899 desc->ComponentType = d->ComponentType;
5900 desc->Register = d->Register;
5901 desc->ReadWriteMask = d->ReadWriteMask;
5902 desc->Mask = d->Mask;
5904 return S_OK;
5908 static const struct ID3D10EffectShaderVariableVtbl d3d10_effect_shader_variable_vtbl =
5910 /* ID3D10EffectVariable methods */
5911 d3d10_effect_shader_variable_IsValid,
5912 d3d10_effect_shader_variable_GetType,
5913 d3d10_effect_shader_variable_GetDesc,
5914 d3d10_effect_shader_variable_GetAnnotationByIndex,
5915 d3d10_effect_shader_variable_GetAnnotationByName,
5916 d3d10_effect_shader_variable_GetMemberByIndex,
5917 d3d10_effect_shader_variable_GetMemberByName,
5918 d3d10_effect_shader_variable_GetMemberBySemantic,
5919 d3d10_effect_shader_variable_GetElement,
5920 d3d10_effect_shader_variable_GetParentConstantBuffer,
5921 d3d10_effect_shader_variable_AsScalar,
5922 d3d10_effect_shader_variable_AsVector,
5923 d3d10_effect_shader_variable_AsMatrix,
5924 d3d10_effect_shader_variable_AsString,
5925 d3d10_effect_shader_variable_AsShaderResource,
5926 d3d10_effect_shader_variable_AsRenderTargetView,
5927 d3d10_effect_shader_variable_AsDepthStencilView,
5928 d3d10_effect_shader_variable_AsConstantBuffer,
5929 d3d10_effect_shader_variable_AsShader,
5930 d3d10_effect_shader_variable_AsBlend,
5931 d3d10_effect_shader_variable_AsDepthStencil,
5932 d3d10_effect_shader_variable_AsRasterizer,
5933 d3d10_effect_shader_variable_AsSampler,
5934 d3d10_effect_shader_variable_SetRawValue,
5935 d3d10_effect_shader_variable_GetRawValue,
5936 /* ID3D10EffectShaderVariable methods */
5937 d3d10_effect_shader_variable_GetShaderDesc,
5938 d3d10_effect_shader_variable_GetVertexShader,
5939 d3d10_effect_shader_variable_GetGeometryShader,
5940 d3d10_effect_shader_variable_GetPixelShader,
5941 d3d10_effect_shader_variable_GetInputSignatureElementDesc,
5942 d3d10_effect_shader_variable_GetOutputSignatureElementDesc,
5945 /* ID3D10EffectVariable methods */
5947 static BOOL STDMETHODCALLTYPE d3d10_effect_blend_variable_IsValid(ID3D10EffectBlendVariable *iface)
5949 TRACE("iface %p\n", iface);
5951 return (struct d3d10_effect_variable *)iface != &null_blend_variable;
5954 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetType(
5955 ID3D10EffectBlendVariable *iface)
5957 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
5960 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetDesc(ID3D10EffectBlendVariable *iface,
5961 D3D10_EFFECT_VARIABLE_DESC *desc)
5963 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
5966 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByIndex(
5967 ID3D10EffectBlendVariable *iface, UINT index)
5969 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
5972 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetAnnotationByName(
5973 ID3D10EffectBlendVariable *iface, const char *name)
5975 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
5978 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByIndex(
5979 ID3D10EffectBlendVariable *iface, UINT index)
5981 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
5984 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberByName(
5985 ID3D10EffectBlendVariable *iface, const char *name)
5987 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
5990 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetMemberBySemantic(
5991 ID3D10EffectBlendVariable *iface, const char *semantic)
5993 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
5996 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetElement(
5997 ID3D10EffectBlendVariable *iface, UINT index)
5999 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6002 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_GetParentConstantBuffer(
6003 ID3D10EffectBlendVariable *iface)
6005 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6008 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsScalar(
6009 ID3D10EffectBlendVariable *iface)
6011 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6014 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsVector(
6015 ID3D10EffectBlendVariable *iface)
6017 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6020 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsMatrix(
6021 ID3D10EffectBlendVariable *iface)
6023 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6026 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsString(
6027 ID3D10EffectBlendVariable *iface)
6029 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6032 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShaderResource(
6033 ID3D10EffectBlendVariable *iface)
6035 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6038 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRenderTargetView(
6039 ID3D10EffectBlendVariable *iface)
6041 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6044 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencilView(
6045 ID3D10EffectBlendVariable *iface)
6047 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6050 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsConstantBuffer(
6051 ID3D10EffectBlendVariable *iface)
6053 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6056 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsShader(
6057 ID3D10EffectBlendVariable *iface)
6059 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6062 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsBlend(
6063 ID3D10EffectBlendVariable *iface)
6065 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6068 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsDepthStencil(
6069 ID3D10EffectBlendVariable *iface)
6071 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6074 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsRasterizer(
6075 ID3D10EffectBlendVariable *iface)
6077 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6080 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_blend_variable_AsSampler(
6081 ID3D10EffectBlendVariable *iface)
6083 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6086 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_SetRawValue(ID3D10EffectBlendVariable *iface,
6087 void *data, UINT offset, UINT count)
6089 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6092 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetRawValue(ID3D10EffectBlendVariable *iface,
6093 void *data, UINT offset, UINT count)
6095 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6098 /* ID3D10EffectBlendVariable methods */
6100 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBlendState(ID3D10EffectBlendVariable *iface,
6101 UINT index, ID3D10BlendState **blend_state)
6103 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6105 TRACE("iface %p, index %u, blend_state %p.\n", iface, index, blend_state);
6107 if (v->type->element_count)
6108 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6109 else if (index)
6110 return E_FAIL;
6112 if (v->type->basetype != D3D10_SVT_BLEND)
6114 WARN("Variable is not a blend state.\n");
6115 return E_FAIL;
6118 if ((*blend_state = v->u.state.object.blend))
6119 ID3D10BlendState_AddRef(*blend_state);
6121 return S_OK;
6124 static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBackingStore(ID3D10EffectBlendVariable *iface,
6125 UINT index, D3D10_BLEND_DESC *desc)
6127 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6129 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6131 if (v->type->element_count)
6132 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6134 if (v->type->basetype != D3D10_SVT_BLEND)
6136 WARN("Variable is not a blend state.\n");
6137 return E_FAIL;
6140 *desc = v->u.state.desc.blend;
6142 return S_OK;
6146 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl =
6148 /* ID3D10EffectVariable methods */
6149 d3d10_effect_blend_variable_IsValid,
6150 d3d10_effect_blend_variable_GetType,
6151 d3d10_effect_blend_variable_GetDesc,
6152 d3d10_effect_blend_variable_GetAnnotationByIndex,
6153 d3d10_effect_blend_variable_GetAnnotationByName,
6154 d3d10_effect_blend_variable_GetMemberByIndex,
6155 d3d10_effect_blend_variable_GetMemberByName,
6156 d3d10_effect_blend_variable_GetMemberBySemantic,
6157 d3d10_effect_blend_variable_GetElement,
6158 d3d10_effect_blend_variable_GetParentConstantBuffer,
6159 d3d10_effect_blend_variable_AsScalar,
6160 d3d10_effect_blend_variable_AsVector,
6161 d3d10_effect_blend_variable_AsMatrix,
6162 d3d10_effect_blend_variable_AsString,
6163 d3d10_effect_blend_variable_AsShaderResource,
6164 d3d10_effect_blend_variable_AsRenderTargetView,
6165 d3d10_effect_blend_variable_AsDepthStencilView,
6166 d3d10_effect_blend_variable_AsConstantBuffer,
6167 d3d10_effect_blend_variable_AsShader,
6168 d3d10_effect_blend_variable_AsBlend,
6169 d3d10_effect_blend_variable_AsDepthStencil,
6170 d3d10_effect_blend_variable_AsRasterizer,
6171 d3d10_effect_blend_variable_AsSampler,
6172 d3d10_effect_blend_variable_SetRawValue,
6173 d3d10_effect_blend_variable_GetRawValue,
6174 /* ID3D10EffectBlendVariable methods */
6175 d3d10_effect_blend_variable_GetBlendState,
6176 d3d10_effect_blend_variable_GetBackingStore,
6179 /* ID3D10EffectVariable methods */
6181 static BOOL STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_IsValid(ID3D10EffectDepthStencilVariable *iface)
6183 TRACE("iface %p\n", iface);
6185 return (struct d3d10_effect_variable *)iface != &null_depth_stencil_variable;
6188 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetType(
6189 ID3D10EffectDepthStencilVariable *iface)
6191 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6194 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDesc(ID3D10EffectDepthStencilVariable *iface,
6195 D3D10_EFFECT_VARIABLE_DESC *desc)
6197 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6200 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByIndex(
6201 ID3D10EffectDepthStencilVariable *iface, UINT index)
6203 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6206 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetAnnotationByName(
6207 ID3D10EffectDepthStencilVariable *iface, const char *name)
6209 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6212 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByIndex(
6213 ID3D10EffectDepthStencilVariable *iface, UINT index)
6215 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6218 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberByName(
6219 ID3D10EffectDepthStencilVariable *iface, const char *name)
6221 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6224 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetMemberBySemantic(
6225 ID3D10EffectDepthStencilVariable *iface, const char *semantic)
6227 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6230 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetElement(
6231 ID3D10EffectDepthStencilVariable *iface, UINT index)
6233 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6236 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetParentConstantBuffer(
6237 ID3D10EffectDepthStencilVariable *iface)
6239 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6242 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsScalar(
6243 ID3D10EffectDepthStencilVariable *iface)
6245 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6248 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsVector(
6249 ID3D10EffectDepthStencilVariable *iface)
6251 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6254 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsMatrix(
6255 ID3D10EffectDepthStencilVariable *iface)
6257 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6260 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsString(
6261 ID3D10EffectDepthStencilVariable *iface)
6263 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6266 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShaderResource(
6267 ID3D10EffectDepthStencilVariable *iface)
6269 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6272 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRenderTargetView(
6273 ID3D10EffectDepthStencilVariable *iface)
6275 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6278 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencilView(
6279 ID3D10EffectDepthStencilVariable *iface)
6281 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6284 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsConstantBuffer(
6285 ID3D10EffectDepthStencilVariable *iface)
6287 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6290 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsShader(
6291 ID3D10EffectDepthStencilVariable *iface)
6293 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6296 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsBlend(
6297 ID3D10EffectDepthStencilVariable *iface)
6299 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6302 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsDepthStencil(
6303 ID3D10EffectDepthStencilVariable *iface)
6305 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6308 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsRasterizer(
6309 ID3D10EffectDepthStencilVariable *iface)
6311 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6314 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_AsSampler(
6315 ID3D10EffectDepthStencilVariable *iface)
6317 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6320 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_SetRawValue(ID3D10EffectDepthStencilVariable *iface,
6321 void *data, UINT offset, UINT count)
6323 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6326 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetRawValue(ID3D10EffectDepthStencilVariable *iface,
6327 void *data, UINT offset, UINT count)
6329 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6332 /* ID3D10EffectDepthStencilVariable methods */
6334 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDepthStencilState(ID3D10EffectDepthStencilVariable *iface,
6335 UINT index, ID3D10DepthStencilState **depth_stencil_state)
6337 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6339 TRACE("iface %p, index %u, depth_stencil_state %p.\n", iface, index, depth_stencil_state);
6341 if (v->type->element_count)
6342 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6343 else if (index)
6344 return E_FAIL;
6346 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6348 WARN("Variable is not a depth stencil state.\n");
6349 return E_FAIL;
6352 if ((*depth_stencil_state = v->u.state.object.depth_stencil))
6353 ID3D10DepthStencilState_AddRef(*depth_stencil_state);
6355 return S_OK;
6358 static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetBackingStore(ID3D10EffectDepthStencilVariable *iface,
6359 UINT index, D3D10_DEPTH_STENCIL_DESC *desc)
6361 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6363 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6365 if (v->type->element_count)
6366 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6368 if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL)
6370 WARN("Variable is not a depth stencil state.\n");
6371 return E_FAIL;
6374 *desc = v->u.state.desc.depth_stencil;
6376 return S_OK;
6380 static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl =
6382 /* ID3D10EffectVariable methods */
6383 d3d10_effect_depth_stencil_variable_IsValid,
6384 d3d10_effect_depth_stencil_variable_GetType,
6385 d3d10_effect_depth_stencil_variable_GetDesc,
6386 d3d10_effect_depth_stencil_variable_GetAnnotationByIndex,
6387 d3d10_effect_depth_stencil_variable_GetAnnotationByName,
6388 d3d10_effect_depth_stencil_variable_GetMemberByIndex,
6389 d3d10_effect_depth_stencil_variable_GetMemberByName,
6390 d3d10_effect_depth_stencil_variable_GetMemberBySemantic,
6391 d3d10_effect_depth_stencil_variable_GetElement,
6392 d3d10_effect_depth_stencil_variable_GetParentConstantBuffer,
6393 d3d10_effect_depth_stencil_variable_AsScalar,
6394 d3d10_effect_depth_stencil_variable_AsVector,
6395 d3d10_effect_depth_stencil_variable_AsMatrix,
6396 d3d10_effect_depth_stencil_variable_AsString,
6397 d3d10_effect_depth_stencil_variable_AsShaderResource,
6398 d3d10_effect_depth_stencil_variable_AsRenderTargetView,
6399 d3d10_effect_depth_stencil_variable_AsDepthStencilView,
6400 d3d10_effect_depth_stencil_variable_AsConstantBuffer,
6401 d3d10_effect_depth_stencil_variable_AsShader,
6402 d3d10_effect_depth_stencil_variable_AsBlend,
6403 d3d10_effect_depth_stencil_variable_AsDepthStencil,
6404 d3d10_effect_depth_stencil_variable_AsRasterizer,
6405 d3d10_effect_depth_stencil_variable_AsSampler,
6406 d3d10_effect_depth_stencil_variable_SetRawValue,
6407 d3d10_effect_depth_stencil_variable_GetRawValue,
6408 /* ID3D10EffectDepthStencilVariable methods */
6409 d3d10_effect_depth_stencil_variable_GetDepthStencilState,
6410 d3d10_effect_depth_stencil_variable_GetBackingStore,
6413 /* ID3D10EffectVariable methods */
6415 static BOOL STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_IsValid(ID3D10EffectRasterizerVariable *iface)
6417 TRACE("iface %p\n", iface);
6419 return (struct d3d10_effect_variable *)iface != &null_rasterizer_variable;
6422 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetType(
6423 ID3D10EffectRasterizerVariable *iface)
6425 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6428 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetDesc(ID3D10EffectRasterizerVariable *iface,
6429 D3D10_EFFECT_VARIABLE_DESC *desc)
6431 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6434 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByIndex(
6435 ID3D10EffectRasterizerVariable *iface, UINT index)
6437 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6440 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetAnnotationByName(
6441 ID3D10EffectRasterizerVariable *iface, const char *name)
6443 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6446 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByIndex(
6447 ID3D10EffectRasterizerVariable *iface, UINT index)
6449 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6452 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberByName(
6453 ID3D10EffectRasterizerVariable *iface, const char *name)
6455 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6458 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetMemberBySemantic(
6459 ID3D10EffectRasterizerVariable *iface, const char *semantic)
6461 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6464 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetElement(
6465 ID3D10EffectRasterizerVariable *iface, UINT index)
6467 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6470 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetParentConstantBuffer(
6471 ID3D10EffectRasterizerVariable *iface)
6473 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6476 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsScalar(
6477 ID3D10EffectRasterizerVariable *iface)
6479 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6482 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsVector(
6483 ID3D10EffectRasterizerVariable *iface)
6485 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6488 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsMatrix(
6489 ID3D10EffectRasterizerVariable *iface)
6491 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6494 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsString(
6495 ID3D10EffectRasterizerVariable *iface)
6497 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6500 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShaderResource(
6501 ID3D10EffectRasterizerVariable *iface)
6503 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6506 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRenderTargetView(
6507 ID3D10EffectRasterizerVariable *iface)
6509 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6512 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencilView(
6513 ID3D10EffectRasterizerVariable *iface)
6515 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6518 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsConstantBuffer(
6519 ID3D10EffectRasterizerVariable *iface)
6521 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6524 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsShader(
6525 ID3D10EffectRasterizerVariable *iface)
6527 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6530 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsBlend(
6531 ID3D10EffectRasterizerVariable *iface)
6533 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6536 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsDepthStencil(
6537 ID3D10EffectRasterizerVariable *iface)
6539 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6542 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsRasterizer(
6543 ID3D10EffectRasterizerVariable *iface)
6545 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6548 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_AsSampler(
6549 ID3D10EffectRasterizerVariable *iface)
6551 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6554 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_SetRawValue(ID3D10EffectRasterizerVariable *iface,
6555 void *data, UINT offset, UINT count)
6557 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6560 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRawValue(ID3D10EffectRasterizerVariable *iface,
6561 void *data, UINT offset, UINT count)
6563 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6566 /* ID3D10EffectRasterizerVariable methods */
6568 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRasterizerState(ID3D10EffectRasterizerVariable *iface,
6569 UINT index, ID3D10RasterizerState **rasterizer_state)
6571 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6573 TRACE("iface %p, index %u, rasterizer_state %p.\n", iface, index, rasterizer_state);
6575 if (v->type->element_count)
6576 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6577 else if (index)
6578 return E_FAIL;
6580 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6582 WARN("Variable is not a rasterizer state.\n");
6583 return E_FAIL;
6586 if ((*rasterizer_state = v->u.state.object.rasterizer))
6587 ID3D10RasterizerState_AddRef(*rasterizer_state);
6589 return S_OK;
6592 static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetBackingStore(ID3D10EffectRasterizerVariable *iface,
6593 UINT index, D3D10_RASTERIZER_DESC *desc)
6595 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6597 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6599 if (v->type->element_count)
6600 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6602 if (v->type->basetype != D3D10_SVT_RASTERIZER)
6604 WARN("Variable is not a rasterizer state.\n");
6605 return E_FAIL;
6608 *desc = v->u.state.desc.rasterizer;
6610 return S_OK;
6614 static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl =
6616 /* ID3D10EffectVariable methods */
6617 d3d10_effect_rasterizer_variable_IsValid,
6618 d3d10_effect_rasterizer_variable_GetType,
6619 d3d10_effect_rasterizer_variable_GetDesc,
6620 d3d10_effect_rasterizer_variable_GetAnnotationByIndex,
6621 d3d10_effect_rasterizer_variable_GetAnnotationByName,
6622 d3d10_effect_rasterizer_variable_GetMemberByIndex,
6623 d3d10_effect_rasterizer_variable_GetMemberByName,
6624 d3d10_effect_rasterizer_variable_GetMemberBySemantic,
6625 d3d10_effect_rasterizer_variable_GetElement,
6626 d3d10_effect_rasterizer_variable_GetParentConstantBuffer,
6627 d3d10_effect_rasterizer_variable_AsScalar,
6628 d3d10_effect_rasterizer_variable_AsVector,
6629 d3d10_effect_rasterizer_variable_AsMatrix,
6630 d3d10_effect_rasterizer_variable_AsString,
6631 d3d10_effect_rasterizer_variable_AsShaderResource,
6632 d3d10_effect_rasterizer_variable_AsRenderTargetView,
6633 d3d10_effect_rasterizer_variable_AsDepthStencilView,
6634 d3d10_effect_rasterizer_variable_AsConstantBuffer,
6635 d3d10_effect_rasterizer_variable_AsShader,
6636 d3d10_effect_rasterizer_variable_AsBlend,
6637 d3d10_effect_rasterizer_variable_AsDepthStencil,
6638 d3d10_effect_rasterizer_variable_AsRasterizer,
6639 d3d10_effect_rasterizer_variable_AsSampler,
6640 d3d10_effect_rasterizer_variable_SetRawValue,
6641 d3d10_effect_rasterizer_variable_GetRawValue,
6642 /* ID3D10EffectRasterizerVariable methods */
6643 d3d10_effect_rasterizer_variable_GetRasterizerState,
6644 d3d10_effect_rasterizer_variable_GetBackingStore,
6647 /* ID3D10EffectVariable methods */
6649 static BOOL STDMETHODCALLTYPE d3d10_effect_sampler_variable_IsValid(ID3D10EffectSamplerVariable *iface)
6651 TRACE("iface %p\n", iface);
6653 return (struct d3d10_effect_variable *)iface != &null_sampler_variable;
6656 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetType(
6657 ID3D10EffectSamplerVariable *iface)
6659 return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
6662 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetDesc(ID3D10EffectSamplerVariable *iface,
6663 D3D10_EFFECT_VARIABLE_DESC *desc)
6665 return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
6668 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByIndex(
6669 ID3D10EffectSamplerVariable *iface, UINT index)
6671 return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
6674 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetAnnotationByName(
6675 ID3D10EffectSamplerVariable *iface, const char *name)
6677 return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
6680 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByIndex(
6681 ID3D10EffectSamplerVariable *iface, UINT index)
6683 return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
6686 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberByName(
6687 ID3D10EffectSamplerVariable *iface, const char *name)
6689 return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
6692 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetMemberBySemantic(
6693 ID3D10EffectSamplerVariable *iface, const char *semantic)
6695 return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
6698 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetElement(
6699 ID3D10EffectSamplerVariable *iface, UINT index)
6701 return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
6704 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetParentConstantBuffer(
6705 ID3D10EffectSamplerVariable *iface)
6707 return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
6710 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsScalar(
6711 ID3D10EffectSamplerVariable *iface)
6713 return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
6716 static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsVector(
6717 ID3D10EffectSamplerVariable *iface)
6719 return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
6722 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsMatrix(
6723 ID3D10EffectSamplerVariable *iface)
6725 return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
6728 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsString(
6729 ID3D10EffectSamplerVariable *iface)
6731 return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
6734 static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShaderResource(
6735 ID3D10EffectSamplerVariable *iface)
6737 return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
6740 static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRenderTargetView(
6741 ID3D10EffectSamplerVariable *iface)
6743 return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
6746 static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencilView(
6747 ID3D10EffectSamplerVariable *iface)
6749 return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
6752 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsConstantBuffer(
6753 ID3D10EffectSamplerVariable *iface)
6755 return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
6758 static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsShader(
6759 ID3D10EffectSamplerVariable *iface)
6761 return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
6764 static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsBlend(
6765 ID3D10EffectSamplerVariable *iface)
6767 return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
6770 static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsDepthStencil(
6771 ID3D10EffectSamplerVariable *iface)
6773 return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
6776 static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsRasterizer(
6777 ID3D10EffectSamplerVariable *iface)
6779 return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
6782 static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_sampler_variable_AsSampler(
6783 ID3D10EffectSamplerVariable *iface)
6785 return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
6788 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_SetRawValue(ID3D10EffectSamplerVariable *iface,
6789 void *data, UINT offset, UINT count)
6791 return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6794 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetRawValue(ID3D10EffectSamplerVariable *iface,
6795 void *data, UINT offset, UINT count)
6797 return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
6800 /* ID3D10EffectSamplerVariable methods */
6802 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetSampler(ID3D10EffectSamplerVariable *iface,
6803 UINT index, ID3D10SamplerState **sampler)
6805 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6807 TRACE("iface %p, index %u, sampler %p.\n", iface, index, sampler);
6809 if (v->type->element_count)
6810 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6811 else if (index)
6812 return E_FAIL;
6814 if (v->type->basetype != D3D10_SVT_SAMPLER)
6816 WARN("Variable is not a sampler state.\n");
6817 return E_FAIL;
6820 if ((*sampler = v->u.state.object.sampler))
6821 ID3D10SamplerState_AddRef(*sampler);
6823 return S_OK;
6826 static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetBackingStore(ID3D10EffectSamplerVariable *iface,
6827 UINT index, D3D10_SAMPLER_DESC *desc)
6829 struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable((ID3D10EffectVariable *)iface);
6831 TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
6833 if (v->type->element_count)
6834 v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
6836 if (v->type->basetype != D3D10_SVT_SAMPLER)
6838 WARN("Variable is not a sampler state.\n");
6839 return E_FAIL;
6842 *desc = v->u.state.desc.sampler;
6844 return S_OK;
6848 static const struct ID3D10EffectSamplerVariableVtbl d3d10_effect_sampler_variable_vtbl =
6850 /* ID3D10EffectVariable methods */
6851 d3d10_effect_sampler_variable_IsValid,
6852 d3d10_effect_sampler_variable_GetType,
6853 d3d10_effect_sampler_variable_GetDesc,
6854 d3d10_effect_sampler_variable_GetAnnotationByIndex,
6855 d3d10_effect_sampler_variable_GetAnnotationByName,
6856 d3d10_effect_sampler_variable_GetMemberByIndex,
6857 d3d10_effect_sampler_variable_GetMemberByName,
6858 d3d10_effect_sampler_variable_GetMemberBySemantic,
6859 d3d10_effect_sampler_variable_GetElement,
6860 d3d10_effect_sampler_variable_GetParentConstantBuffer,
6861 d3d10_effect_sampler_variable_AsScalar,
6862 d3d10_effect_sampler_variable_AsVector,
6863 d3d10_effect_sampler_variable_AsMatrix,
6864 d3d10_effect_sampler_variable_AsString,
6865 d3d10_effect_sampler_variable_AsShaderResource,
6866 d3d10_effect_sampler_variable_AsRenderTargetView,
6867 d3d10_effect_sampler_variable_AsDepthStencilView,
6868 d3d10_effect_sampler_variable_AsConstantBuffer,
6869 d3d10_effect_sampler_variable_AsShader,
6870 d3d10_effect_sampler_variable_AsBlend,
6871 d3d10_effect_sampler_variable_AsDepthStencil,
6872 d3d10_effect_sampler_variable_AsRasterizer,
6873 d3d10_effect_sampler_variable_AsSampler,
6874 d3d10_effect_sampler_variable_SetRawValue,
6875 d3d10_effect_sampler_variable_GetRawValue,
6876 /* ID3D10EffectSamplerVariable methods */
6877 d3d10_effect_sampler_variable_GetSampler,
6878 d3d10_effect_sampler_variable_GetBackingStore,
6881 /* ID3D10EffectType methods */
6883 static inline struct d3d10_effect_type *impl_from_ID3D10EffectType(ID3D10EffectType *iface)
6885 return CONTAINING_RECORD(iface, struct d3d10_effect_type, ID3D10EffectType_iface);
6888 static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
6890 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6892 TRACE("iface %p\n", iface);
6894 return This != &null_type;
6897 static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *iface, D3D10_EFFECT_TYPE_DESC *desc)
6899 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6901 TRACE("iface %p, desc %p\n", iface, desc);
6903 if (This == &null_type)
6905 WARN("Null type specified\n");
6906 return E_FAIL;
6909 if (!desc)
6911 WARN("Invalid argument specified\n");
6912 return E_INVALIDARG;
6915 desc->TypeName = This->name;
6916 desc->Class = This->type_class;
6917 desc->Type = This->basetype;
6918 desc->Elements = This->element_count;
6919 desc->Members = This->member_count;
6920 desc->Rows = This->row_count;
6921 desc->Columns = This->column_count;
6922 desc->PackedSize = This->size_packed;
6923 desc->UnpackedSize = This->size_unpacked;
6924 desc->Stride = This->stride;
6926 return S_OK;
6929 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByIndex(ID3D10EffectType *iface,
6930 UINT index)
6932 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6933 struct d3d10_effect_type *t;
6935 TRACE("iface %p, index %u\n", iface, index);
6937 if (index >= This->member_count)
6939 WARN("Invalid index specified\n");
6940 return &null_type.ID3D10EffectType_iface;
6943 t = (&This->members[index])->type;
6945 TRACE("Returning member %p, %s\n", t, debugstr_a(t->name));
6947 return &t->ID3D10EffectType_iface;
6950 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByName(ID3D10EffectType *iface,
6951 const char *name)
6953 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6954 unsigned int i;
6956 TRACE("iface %p, name %s\n", iface, debugstr_a(name));
6958 if (!name)
6960 WARN("Invalid name specified\n");
6961 return &null_type.ID3D10EffectType_iface;
6964 for (i = 0; i < This->member_count; ++i)
6966 struct d3d10_effect_type_member *typem = &This->members[i];
6968 if (typem->name)
6970 if (!strcmp(typem->name, name))
6972 TRACE("Returning type %p.\n", typem->type);
6973 return &typem->type->ID3D10EffectType_iface;
6978 WARN("Invalid name specified\n");
6980 return &null_type.ID3D10EffectType_iface;
6983 static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeBySemantic(ID3D10EffectType *iface,
6984 const char *semantic)
6986 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
6987 unsigned int i;
6989 TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic));
6991 if (!semantic)
6993 WARN("Invalid semantic specified\n");
6994 return &null_type.ID3D10EffectType_iface;
6997 for (i = 0; i < This->member_count; ++i)
6999 struct d3d10_effect_type_member *typem = &This->members[i];
7001 if (typem->semantic)
7003 if (!strcmp(typem->semantic, semantic))
7005 TRACE("Returning type %p.\n", typem->type);
7006 return &typem->type->ID3D10EffectType_iface;
7011 WARN("Invalid semantic specified\n");
7013 return &null_type.ID3D10EffectType_iface;
7016 static const char * STDMETHODCALLTYPE d3d10_effect_type_GetMemberName(ID3D10EffectType *iface, UINT index)
7018 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7019 struct d3d10_effect_type_member *typem;
7021 TRACE("iface %p, index %u\n", iface, index);
7023 if (index >= This->member_count)
7025 WARN("Invalid index specified\n");
7026 return NULL;
7029 typem = &This->members[index];
7031 TRACE("Returning name %s\n", debugstr_a(typem->name));
7033 return typem->name;
7036 static const char * STDMETHODCALLTYPE d3d10_effect_type_GetMemberSemantic(ID3D10EffectType *iface, UINT index)
7038 struct d3d10_effect_type *This = impl_from_ID3D10EffectType(iface);
7039 struct d3d10_effect_type_member *typem;
7041 TRACE("iface %p, index %u\n", iface, index);
7043 if (index >= This->member_count)
7045 WARN("Invalid index specified\n");
7046 return NULL;
7049 typem = &This->members[index];
7051 TRACE("Returning semantic %s\n", debugstr_a(typem->semantic));
7053 return typem->semantic;
7056 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl =
7058 /* ID3D10EffectType */
7059 d3d10_effect_type_IsValid,
7060 d3d10_effect_type_GetDesc,
7061 d3d10_effect_type_GetMemberTypeByIndex,
7062 d3d10_effect_type_GetMemberTypeByName,
7063 d3d10_effect_type_GetMemberTypeBySemantic,
7064 d3d10_effect_type_GetMemberName,
7065 d3d10_effect_type_GetMemberSemantic,