VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d8/vertexdeclaration.c@ 39602

Last change on this file since 39602 was 35332, checked in by vboxsync, 14 years ago

wine/xpdm: commpilable 64bit version (not tested yet)

  • Property svn:eol-style set to native
File size: 17.6 KB
Line 
1/*
2 * IDirect3DVertexDeclaration8 implementation
3 *
4 * Copyright 2007 Henri Verbeet
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21/*
22 * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
23 * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
24 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
25 * a choice of LGPL license versions is made available with the language indicating
26 * that LGPLv2 or any later version may be used, or where a choice of which version
27 * of the LGPL is applied is otherwise unspecified.
28 */
29
30/* IDirect3DVertexDeclaration8 is internal to our implementation.
31 * It's not visible in the API. */
32
33#include "config.h"
34#include "d3d8_private.h"
35
36WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
37
38/* IUnknown */
39static HRESULT WINAPI IDirect3DVertexDeclaration8Impl_QueryInterface(IDirect3DVertexDeclaration8 *iface, REFIID riid, void **obj_ptr)
40{
41 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj_ptr);
42
43 if (IsEqualGUID(riid, &IID_IUnknown)
44 || IsEqualGUID(riid, &IID_IDirect3DVertexDeclaration8))
45 {
46 IUnknown_AddRef(iface);
47 *obj_ptr = iface;
48 return S_OK;
49 }
50
51 *obj_ptr = NULL;
52 return E_NOINTERFACE;
53}
54
55static ULONG WINAPI IDirect3DVertexDeclaration8Impl_AddRef(IDirect3DVertexDeclaration8 *iface)
56{
57 IDirect3DVertexDeclaration8Impl *This = (IDirect3DVertexDeclaration8Impl *)iface;
58 ULONG ref_count = InterlockedIncrement(&This->ref_count);
59
60 TRACE("%p increasing refcount to %u.\n", iface, ref_count);
61
62 if (ref_count == 1)
63 {
64 wined3d_mutex_lock();
65 IWineD3DVertexDeclaration_AddRef(This->wined3d_vertex_declaration);
66 wined3d_mutex_unlock();
67 }
68
69 return ref_count;
70}
71
72static ULONG WINAPI IDirect3DVertexDeclaration8Impl_Release(IDirect3DVertexDeclaration8 *iface)
73{
74 IDirect3DVertexDeclaration8Impl *This = (IDirect3DVertexDeclaration8Impl *)iface;
75 ULONG ref_count = InterlockedDecrement(&This->ref_count);
76
77 TRACE("%p decreasing refcount to %u.\n", iface, ref_count);
78
79 if (!ref_count) {
80 wined3d_mutex_lock();
81 IWineD3DVertexDeclaration_Release(This->wined3d_vertex_declaration);
82 wined3d_mutex_unlock();
83 }
84
85 return ref_count;
86}
87
88#ifdef VBOX_WINE_WITHOUT_LIBWINE
89/* wine defines D3DVSDT_TYPE enumeration while native win headers use D3DVSDT_Xxx defines
90 * and D3DVSDT_TYPE is not defined.
91 * Define it here:*/
92typedef UINT D3DVSDT_TYPE;
93
94/* wine defines D3DVSDE_REGISTER enumeration while native win headers use D3DVSDE_Xxx defines
95 * and D3DVSDE_REGISTER is not defined.
96 * Define it here:*/
97typedef UINT D3DVSDE_REGISTER;
98
99#endif
100
101static const char *debug_d3dvsdt_type(D3DVSDT_TYPE d3dvsdt_type)
102{
103 switch (d3dvsdt_type)
104 {
105#define D3DVSDT_TYPE_TO_STR(u) case u: return #u
106 D3DVSDT_TYPE_TO_STR(D3DVSDT_FLOAT1);
107 D3DVSDT_TYPE_TO_STR(D3DVSDT_FLOAT2);
108 D3DVSDT_TYPE_TO_STR(D3DVSDT_FLOAT3);
109 D3DVSDT_TYPE_TO_STR(D3DVSDT_FLOAT4);
110 D3DVSDT_TYPE_TO_STR(D3DVSDT_D3DCOLOR);
111 D3DVSDT_TYPE_TO_STR(D3DVSDT_UBYTE4);
112 D3DVSDT_TYPE_TO_STR(D3DVSDT_SHORT2);
113 D3DVSDT_TYPE_TO_STR(D3DVSDT_SHORT4);
114#undef D3DVSDT_TYPE_TO_STR
115 default:
116 FIXME("Unrecognized D3DVSDT_TYPE %#x\n", d3dvsdt_type);
117 return "unrecognized";
118 }
119}
120
121static const char *debug_d3dvsde_register(D3DVSDE_REGISTER d3dvsde_register)
122{
123 switch (d3dvsde_register)
124 {
125#define D3DVSDE_REGISTER_TO_STR(u) case u: return #u
126 D3DVSDE_REGISTER_TO_STR(D3DVSDE_POSITION);
127 D3DVSDE_REGISTER_TO_STR(D3DVSDE_BLENDWEIGHT);
128 D3DVSDE_REGISTER_TO_STR(D3DVSDE_BLENDINDICES);
129 D3DVSDE_REGISTER_TO_STR(D3DVSDE_NORMAL);
130 D3DVSDE_REGISTER_TO_STR(D3DVSDE_PSIZE);
131 D3DVSDE_REGISTER_TO_STR(D3DVSDE_DIFFUSE);
132 D3DVSDE_REGISTER_TO_STR(D3DVSDE_SPECULAR);
133 D3DVSDE_REGISTER_TO_STR(D3DVSDE_TEXCOORD0);
134 D3DVSDE_REGISTER_TO_STR(D3DVSDE_TEXCOORD1);
135 D3DVSDE_REGISTER_TO_STR(D3DVSDE_TEXCOORD2);
136 D3DVSDE_REGISTER_TO_STR(D3DVSDE_TEXCOORD3);
137 D3DVSDE_REGISTER_TO_STR(D3DVSDE_TEXCOORD4);
138 D3DVSDE_REGISTER_TO_STR(D3DVSDE_TEXCOORD5);
139 D3DVSDE_REGISTER_TO_STR(D3DVSDE_TEXCOORD6);
140 D3DVSDE_REGISTER_TO_STR(D3DVSDE_TEXCOORD7);
141 D3DVSDE_REGISTER_TO_STR(D3DVSDE_POSITION2);
142 D3DVSDE_REGISTER_TO_STR(D3DVSDE_NORMAL2);
143#undef D3DVSDE_REGISTER_TO_STR
144 default:
145 FIXME("Unrecognized D3DVSDE_REGISTER %#x\n", d3dvsde_register);
146 return "unrecognized";
147 }
148}
149
150size_t parse_token(const DWORD* pToken)
151{
152 const DWORD token = *pToken;
153 size_t tokenlen = 1;
154
155 switch ((token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT) { /* maybe a macro to inverse ... */
156 case D3DVSD_TOKEN_NOP:
157 TRACE(" 0x%08x NOP()\n", token);
158 break;
159
160 case D3DVSD_TOKEN_STREAM:
161 if (token & D3DVSD_STREAMTESSMASK)
162 {
163 TRACE(" 0x%08x STREAM_TESS()\n", token);
164 } else {
165 TRACE(" 0x%08x STREAM(%u)\n", token, ((token & D3DVSD_STREAMNUMBERMASK) >> D3DVSD_STREAMNUMBERSHIFT));
166 }
167 break;
168
169 case D3DVSD_TOKEN_STREAMDATA:
170 if (token & 0x10000000)
171 {
172 TRACE(" 0x%08x SKIP(%u)\n", token, ((token & D3DVSD_SKIPCOUNTMASK) >> D3DVSD_SKIPCOUNTSHIFT));
173 } else {
174 DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT);
175 DWORD reg = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT);
176 TRACE(" 0x%08x REG(%s, %s)\n", token, debug_d3dvsde_register(reg), debug_d3dvsdt_type(type));
177 }
178 break;
179
180 case D3DVSD_TOKEN_TESSELLATOR:
181 if (token & 0x10000000)
182 {
183 DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT);
184 DWORD reg = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT);
185 TRACE(" 0x%08x TESSUV(%s) as %s\n", token, debug_d3dvsde_register(reg), debug_d3dvsdt_type(type));
186 } else {
187 DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT);
188 DWORD regout = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT);
189 DWORD regin = ((token & D3DVSD_VERTEXREGINMASK) >> D3DVSD_VERTEXREGINSHIFT);
190 TRACE(" 0x%08x TESSNORMAL(%s, %s) as %s\n", token, debug_d3dvsde_register(regin),
191 debug_d3dvsde_register(regout), debug_d3dvsdt_type(type));
192 }
193 break;
194
195 case D3DVSD_TOKEN_CONSTMEM:
196 {
197 DWORD count = ((token & D3DVSD_CONSTCOUNTMASK) >> D3DVSD_CONSTCOUNTSHIFT);
198 tokenlen = (4 * count) + 1;
199 }
200 break;
201
202 case D3DVSD_TOKEN_EXT:
203 {
204 DWORD count = ((token & D3DVSD_CONSTCOUNTMASK) >> D3DVSD_CONSTCOUNTSHIFT);
205 DWORD extinfo = ((token & D3DVSD_EXTINFOMASK) >> D3DVSD_EXTINFOSHIFT);
206 TRACE(" 0x%08x EXT(%u, %u)\n", token, count, extinfo);
207 /* todo ... print extension */
208 tokenlen = count + 1;
209 }
210 break;
211
212 case D3DVSD_TOKEN_END:
213 TRACE(" 0x%08x END()\n", token);
214 break;
215
216 default:
217 TRACE(" 0x%08x UNKNOWN\n", token);
218 /* argg error */
219 }
220
221 return tokenlen;
222}
223
224void load_local_constants(const DWORD *d3d8_elements, IWineD3DVertexShader *wined3d_vertex_shader)
225{
226 const DWORD *token = d3d8_elements;
227
228 while (*token != D3DVSD_END())
229 {
230 if (((*token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT) == D3DVSD_TOKEN_CONSTMEM)
231 {
232 DWORD count = ((*token & D3DVSD_CONSTCOUNTMASK) >> D3DVSD_CONSTCOUNTSHIFT);
233 DWORD constant_idx = ((*token & D3DVSD_CONSTADDRESSMASK) >> D3DVSD_CONSTADDRESSSHIFT);
234 HRESULT hr;
235
236 if (TRACE_ON(d3d8))
237 {
238 DWORD i;
239 for (i = 0; i < count; ++i)
240 {
241 TRACE("c[%u] = (%8f, %8f, %8f, %8f)\n",
242 constant_idx,
243 *(const float *)(token + i * 4 + 1),
244 *(const float *)(token + i * 4 + 2),
245 *(const float *)(token + i * 4 + 3),
246 *(const float *)(token + i * 4 + 4));
247 }
248 }
249 hr = IWineD3DVertexShader_SetLocalConstantsF(wined3d_vertex_shader, constant_idx, (const float *)token+1, count);
250 if (FAILED(hr)) ERR("Failed setting shader constants\n");
251 }
252
253 token += parse_token(token);
254 }
255}
256
257/* NOTE: Make sure these are in the correct numerical order. (see /include/wined3d_types.h) */
258static const size_t wined3d_type_sizes[] =
259{
260 /*WINED3DDECLTYPE_FLOAT1*/ 1 * sizeof(float),
261 /*WINED3DDECLTYPE_FLOAT2*/ 2 * sizeof(float),
262 /*WINED3DDECLTYPE_FLOAT3*/ 3 * sizeof(float),
263 /*WINED3DDECLTYPE_FLOAT4*/ 4 * sizeof(float),
264 /*WINED3DDECLTYPE_D3DCOLOR*/ 4 * sizeof(BYTE),
265 /*WINED3DDECLTYPE_UBYTE4*/ 4 * sizeof(BYTE),
266 /*WINED3DDECLTYPE_SHORT2*/ 2 * sizeof(short int),
267 /*WINED3DDECLTYPE_SHORT4*/ 4 * sizeof(short int),
268 /*WINED3DDECLTYPE_UBYTE4N*/ 4 * sizeof(BYTE),
269 /*WINED3DDECLTYPE_SHORT2N*/ 2 * sizeof(short int),
270 /*WINED3DDECLTYPE_SHORT4N*/ 4 * sizeof(short int),
271 /*WINED3DDECLTYPE_USHORT2N*/ 2 * sizeof(short int),
272 /*WINED3DDECLTYPE_USHORT4N*/ 4 * sizeof(short int),
273 /*WINED3DDECLTYPE_UDEC3*/ 3 * sizeof(short int),
274 /*WINED3DDECLTYPE_DEC3N*/ 3 * sizeof(short int),
275 /*WINED3DDECLTYPE_FLOAT16_2*/ 2 * sizeof(short int),
276 /*WINED3DDECLTYPE_FLOAT16_4*/ 4 * sizeof(short int)
277};
278
279static const WINED3DFORMAT wined3d_format_lookup[] =
280{
281 /*WINED3DDECLTYPE_FLOAT1*/ WINED3DFMT_R32_FLOAT,
282 /*WINED3DDECLTYPE_FLOAT2*/ WINED3DFMT_R32G32_FLOAT,
283 /*WINED3DDECLTYPE_FLOAT3*/ WINED3DFMT_R32G32B32_FLOAT,
284 /*WINED3DDECLTYPE_FLOAT4*/ WINED3DFMT_R32G32B32A32_FLOAT,
285 /*WINED3DDECLTYPE_D3DCOLOR*/ WINED3DFMT_B8G8R8A8_UNORM,
286 /*WINED3DDECLTYPE_UBYTE4*/ WINED3DFMT_R8G8B8A8_UINT,
287 /*WINED3DDECLTYPE_SHORT2*/ WINED3DFMT_R16G16_SINT,
288 /*WINED3DDECLTYPE_SHORT4*/ WINED3DFMT_R16G16B16A16_SINT,
289 /*WINED3DDECLTYPE_UBYTE4N*/ WINED3DFMT_R8G8B8A8_UNORM,
290 /*WINED3DDECLTYPE_SHORT2N*/ WINED3DFMT_R16G16_SNORM,
291 /*WINED3DDECLTYPE_SHORT4N*/ WINED3DFMT_R16G16B16A16_SNORM,
292 /*WINED3DDECLTYPE_USHORT2N*/ WINED3DFMT_R16G16_UNORM,
293 /*WINED3DDECLTYPE_USHORT4N*/ WINED3DFMT_R16G16B16A16_UNORM,
294 /*WINED3DDECLTYPE_UDEC3*/ WINED3DFMT_R10G10B10A2_UINT,
295 /*WINED3DDECLTYPE_DEC3N*/ WINED3DFMT_R10G10B10A2_SNORM,
296 /*WINED3DDECLTYPE_FLOAT16_2*/ WINED3DFMT_R16G16_FLOAT,
297 /*WINED3DDECLTYPE_FLOAT16_4*/ WINED3DFMT_R16G16B16A16_FLOAT,
298};
299
300typedef struct {
301 BYTE usage;
302 BYTE usage_idx;
303} wined3d_usage_t;
304
305static const wined3d_usage_t wined3d_usage_lookup[] = {
306 /*D3DVSDE_POSITION*/ {WINED3DDECLUSAGE_POSITION, 0},
307 /*D3DVSDE_BLENDWEIGHT*/ {WINED3DDECLUSAGE_BLENDWEIGHT, 0},
308 /*D3DVSDE_BLENDINDICES*/ {WINED3DDECLUSAGE_BLENDINDICES, 0},
309 /*D3DVSDE_NORMAL*/ {WINED3DDECLUSAGE_NORMAL, 0},
310 /*D3DVSDE_PSIZE*/ {WINED3DDECLUSAGE_PSIZE, 0},
311 /*D3DVSDE_DIFFUSE*/ {WINED3DDECLUSAGE_COLOR, 0},
312 /*D3DVSDE_SPECULAR*/ {WINED3DDECLUSAGE_COLOR, 1},
313 /*D3DVSDE_TEXCOORD0*/ {WINED3DDECLUSAGE_TEXCOORD, 0},
314 /*D3DVSDE_TEXCOORD1*/ {WINED3DDECLUSAGE_TEXCOORD, 1},
315 /*D3DVSDE_TEXCOORD2*/ {WINED3DDECLUSAGE_TEXCOORD, 2},
316 /*D3DVSDE_TEXCOORD3*/ {WINED3DDECLUSAGE_TEXCOORD, 3},
317 /*D3DVSDE_TEXCOORD4*/ {WINED3DDECLUSAGE_TEXCOORD, 4},
318 /*D3DVSDE_TEXCOORD5*/ {WINED3DDECLUSAGE_TEXCOORD, 5},
319 /*D3DVSDE_TEXCOORD6*/ {WINED3DDECLUSAGE_TEXCOORD, 6},
320 /*D3DVSDE_TEXCOORD7*/ {WINED3DDECLUSAGE_TEXCOORD, 7},
321 /*D3DVSDE_POSITION2*/ {WINED3DDECLUSAGE_POSITION, 1},
322 /*D3DVSDE_NORMAL2*/ {WINED3DDECLUSAGE_NORMAL, 1},
323};
324
325/* TODO: find out where rhw (or positionT) is for declaration8 */
326static UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elements_size,
327 WINED3DVERTEXELEMENT **wined3d_elements)
328{
329 const DWORD *token = d3d8_elements;
330 WINED3DVERTEXELEMENT *element;
331 D3DVSD_TOKENTYPE token_type;
332 unsigned int element_count = 0;
333 DWORD stream = 0;
334 int offset = 0;
335
336 TRACE("d3d8_elements %p, wined3d_elements %p\n", d3d8_elements, wined3d_elements);
337
338 /* 128 should be enough for anyone... */
339 *wined3d_elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 128 * sizeof(WINED3DVERTEXELEMENT));
340 while (D3DVSD_END() != *token)
341 {
342 token_type = ((*token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT);
343
344 if (token_type == D3DVSD_TOKEN_STREAM && !(*token & D3DVSD_STREAMTESSMASK))
345 {
346 stream = ((*token & D3DVSD_STREAMNUMBERMASK) >> D3DVSD_STREAMNUMBERSHIFT);
347 offset = 0;
348 } else if (token_type == D3DVSD_TOKEN_STREAMDATA && !(token_type & 0x10000000)) {
349 DWORD type = ((*token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT);
350 DWORD reg = ((*token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT);
351
352 TRACE("Adding element %d:\n", element_count);
353
354 element = *wined3d_elements + element_count++;
355 element->format = wined3d_format_lookup[type];
356 element->input_slot = stream;
357 element->offset = offset;
358 element->output_slot = reg;
359 element->method = WINED3DDECLMETHOD_DEFAULT;
360 element->usage = wined3d_usage_lookup[reg].usage;
361 element->usage_idx = wined3d_usage_lookup[reg].usage_idx;
362
363 offset += wined3d_type_sizes[type];
364 } else if (token_type == D3DVSD_TOKEN_STREAMDATA && (token_type & 0x10000000)) {
365 TRACE(" 0x%08x SKIP(%u)\n", token_type, ((token_type & D3DVSD_SKIPCOUNTMASK) >> D3DVSD_SKIPCOUNTSHIFT));
366 offset += sizeof(DWORD) * ((token_type & D3DVSD_SKIPCOUNTMASK) >> D3DVSD_SKIPCOUNTSHIFT);
367 }
368
369 if (element_count >= 127) {
370 ERR("More than 127 elements?\n");
371 break;
372 }
373
374 token += parse_token(token);
375 }
376
377 *d3d8_elements_size = (++token - d3d8_elements) * sizeof(DWORD);
378
379 return element_count;
380}
381
382static const IDirect3DVertexDeclaration8Vtbl Direct3DVertexDeclaration8_Vtbl =
383{
384 IDirect3DVertexDeclaration8Impl_QueryInterface,
385 IDirect3DVertexDeclaration8Impl_AddRef,
386 IDirect3DVertexDeclaration8Impl_Release
387};
388
389static void STDMETHODCALLTYPE d3d8_vertexdeclaration_wined3d_object_destroyed(void *parent)
390{
391 IDirect3DVertexDeclaration8Impl *declaration = parent;
392 HeapFree(GetProcessHeap(), 0, declaration->elements);
393 HeapFree(GetProcessHeap(), 0, declaration);
394}
395
396static const struct wined3d_parent_ops d3d8_vertexdeclaration_wined3d_parent_ops =
397{
398 d3d8_vertexdeclaration_wined3d_object_destroyed,
399};
400
401HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration8Impl *declaration,
402 IDirect3DDevice8Impl *device, const DWORD *elements, DWORD shader_handle)
403{
404 WINED3DVERTEXELEMENT *wined3d_elements;
405 UINT wined3d_element_count;
406 HRESULT hr;
407
408 declaration->lpVtbl = &Direct3DVertexDeclaration8_Vtbl;
409 declaration->ref_count = 1;
410 declaration->shader_handle = shader_handle;
411
412 wined3d_element_count = convert_to_wined3d_declaration(elements, &declaration->elements_size, &wined3d_elements);
413 declaration->elements = HeapAlloc(GetProcessHeap(), 0, declaration->elements_size);
414 if (!declaration->elements)
415 {
416 ERR("Failed to allocate vertex declaration elements memory.\n");
417 HeapFree(GetProcessHeap(), 0, wined3d_elements);
418 return E_OUTOFMEMORY;
419 }
420
421 memcpy(declaration->elements, elements, declaration->elements_size);
422
423 wined3d_mutex_lock();
424 hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, &declaration->wined3d_vertex_declaration,
425 (IUnknown *)declaration, &d3d8_vertexdeclaration_wined3d_parent_ops,
426 wined3d_elements, wined3d_element_count);
427 wined3d_mutex_unlock();
428 HeapFree(GetProcessHeap(), 0, wined3d_elements);
429 if (FAILED(hr))
430 {
431 WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
432 HeapFree(GetProcessHeap(), 0, declaration->elements);
433 return hr;
434 }
435
436 return D3D_OK;
437}
438
439HRESULT vertexdeclaration_init_fvf(IDirect3DVertexDeclaration8Impl *declaration,
440 IDirect3DDevice8Impl *device, DWORD fvf)
441{
442 HRESULT hr;
443
444 declaration->ref_count = 1;
445 declaration->lpVtbl = &Direct3DVertexDeclaration8_Vtbl;
446 declaration->elements = NULL;
447 declaration->elements_size = 0;
448 declaration->shader_handle = fvf;
449
450 hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(device->WineD3DDevice,
451 &declaration->wined3d_vertex_declaration, (IUnknown *)declaration,
452 &d3d8_vertexdeclaration_wined3d_parent_ops, fvf);
453 if (FAILED(hr))
454 {
455 WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
456 return hr;
457 }
458
459 return D3D_OK;
460}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette