mcicda: Exclude unused headers.
[wine] / dlls / ddraw / vertexbuffer.c
1 /* Direct3D Vertex Buffer
2  * Copyright (c) 2002 Lionel ULMER
3  * Copyright (c) 2006 Stefan DÖSINGER
4  *
5  * This file contains the implementation of Direct3DVertexBuffer COM object
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include "config.h"
23 #include "wine/port.h"
24 #include "wine/debug.h"
25
26 #include <assert.h>
27 #include <stdarg.h>
28 #include <string.h>
29 #include <stdlib.h>
30
31 #define COBJMACROS
32
33 #include "windef.h"
34 #include "winbase.h"
35 #include "winerror.h"
36 #include "wingdi.h"
37 #include "wine/exception.h"
38
39 #include "ddraw.h"
40 #include "d3d.h"
41
42 #include "ddraw_private.h"
43
44 WINE_DEFAULT_DEBUG_CHANNEL(d3d7);
45 WINE_DECLARE_DEBUG_CHANNEL(ddraw_thunk);
46
47
48 /*****************************************************************************
49  * IUnknown Methods
50  *****************************************************************************/
51
52 /*****************************************************************************
53  * IDirect3DVertexBuffer7::QueryInterface
54  *
55  * The QueryInterface Method for Vertex Buffers
56  * For a link to QueryInterface rules, see IDirectDraw7::QueryInterface
57  *
58  * Params
59  *  riid: Queryied Interface id
60  *  obj: Address to return the interface pointer
61  *
62  * Returns:
63  *  S_OK on success
64  *  E_NOINTERFACE if the interface wasn't found
65  *
66  *****************************************************************************/
67 static HRESULT WINAPI
68 IDirect3DVertexBufferImpl_QueryInterface(IDirect3DVertexBuffer7 *iface,
69                                          REFIID riid,
70                                          void  **obj)
71 {
72     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
73     TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obj);
74
75     /* By default, set the object pointer to NULL */
76     *obj = NULL;
77
78     if ( IsEqualGUID( &IID_IUnknown,  riid ) )
79     {
80         IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This,IDirect3DVertexBuffer7));
81         *obj = iface;
82         TRACE("  Creating IUnknown interface at %p.\n", *obj);
83         return S_OK;
84     }
85     if ( IsEqualGUID( &IID_IDirect3DVertexBuffer, riid ) )
86     {
87         IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This,IDirect3DVertexBuffer7));
88         *obj = ICOM_INTERFACE(This, IDirect3DVertexBuffer);
89         TRACE("  Creating IDirect3DVertexBuffer interface %p\n", *obj);
90         return S_OK;
91     }
92     if ( IsEqualGUID( &IID_IDirect3DVertexBuffer7, riid ) )
93     {
94         IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This,IDirect3DVertexBuffer7));
95         *obj = ICOM_INTERFACE(This, IDirect3DVertexBuffer7);
96         TRACE("  Creating IDirect3DVertexBuffer7 interface %p\n", *obj);
97         return S_OK;
98     }
99     FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
100     return E_NOINTERFACE;
101 }
102
103 static HRESULT WINAPI
104 Thunk_IDirect3DVertexBufferImpl_1_QueryInterface(IDirect3DVertexBuffer *iface,
105                                                  REFIID riid,
106                                                  void **obj)
107 {
108     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
109     TRACE_(ddraw_thunk)("(%p)->(%s,%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, debugstr_guid(riid), obj);
110
111     return IDirect3DVertexBuffer7_QueryInterface(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
112                                                  riid,
113                                                  obj);
114 }
115
116 /*****************************************************************************
117  * IDirect3DVertexBuffer7::AddRef
118  *
119  * AddRef for Vertex Buffers
120  *
121  * Returns:
122  *  The new refcount
123  *
124  *****************************************************************************/
125 static ULONG WINAPI
126 IDirect3DVertexBufferImpl_AddRef(IDirect3DVertexBuffer7 *iface)
127 {
128     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
129     ULONG ref = InterlockedIncrement(&This->ref);
130
131     TRACE("(%p/%p)->() incrementing from %u.\n", This, iface, ref - 1);
132
133     return ref;
134 }
135
136 static ULONG WINAPI
137 Thunk_IDirect3DVertexBufferImpl_1_AddRef(IDirect3DVertexBuffer *iface)
138 {
139     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
140     TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This);
141
142     return IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This, IDirect3DVertexBuffer7));
143 }
144
145
146 /*****************************************************************************
147  * IDirect3DVertexBuffer7::Release
148  *
149  * Release for Vertex Buffers
150  *
151  * Returns:
152  *  The new refcount
153  *
154  *****************************************************************************/
155 static ULONG WINAPI
156 IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *iface)
157 {
158     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
159     ULONG ref = InterlockedDecrement(&This->ref);
160
161     TRACE("(%p)->() decrementing from %u.\n", This, ref + 1);
162
163     if (ref == 0)
164     {
165         IWineD3DVertexBuffer *curVB = NULL;
166         UINT offset, stride;
167
168         /* D3D7 Vertex buffers don't stay bound in the device, they are passed as a parameter
169          * to drawPrimitiveVB. DrawPrimitiveVB sets them as the stream source in wined3d,
170          * and they should get unset there before they are destroyed
171          */
172         IWineD3DDevice_GetStreamSource(This->ddraw->wineD3DDevice,
173                                        0 /* Stream number */,
174                                        &curVB,
175                                        &offset,
176                                        &stride);
177         if(curVB == This->wineD3DVertexBuffer)
178         {
179             IWineD3DDevice_SetStreamSource(This->ddraw->wineD3DDevice,
180                                         0 /* Steam number */,
181                                         NULL /* stream data */,
182                                         0 /* Offset */,
183                                         0 /* stride */);
184         }
185         if(curVB)
186         {
187             IWineD3DVertexBuffer_Release(curVB); /* For the GetStreamSource */
188         }
189
190         IWineD3DVertexDeclaration_Release(This->wineD3DVertexDeclaration);
191         IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
192         HeapFree(GetProcessHeap(), 0, This);
193         return 0;
194     }
195     return ref;
196 }
197
198 static ULONG WINAPI
199 Thunk_IDirect3DVertexBufferImpl_1_Release(IDirect3DVertexBuffer *iface)
200 {
201     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
202     TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This);
203
204     return IDirect3DVertexBuffer7_Release(ICOM_INTERFACE(This, IDirect3DVertexBuffer7));
205 }
206
207 /*****************************************************************************
208  * IDirect3DVertexBuffer Methods
209  *****************************************************************************/
210
211 /*****************************************************************************
212  * IDirect3DVertexBuffer7::Lock
213  *
214  * Locks the vertex buffer and returns a pointer to the vertex data
215  * Locking vertex buffers is similar to locking surfaces, because Windows
216  * uses surfaces to store vertex data internally (According to the DX sdk)
217  *
218  * Params:
219  *  Flags: Locking flags. Relevant here are DDLOCK_READONLY, DDLOCK_WRITEONLY,
220  *         DDLOCK_DISCARDCONTENTS and DDLOCK_NOOVERWRITE.
221  *  Data:  Returns a pointer to the vertex data
222  *  Size:  Returns the size of the buffer if not NULL
223  *
224  * Returns:
225  *  D3D_OK on success
226  *  DDERR_INVALIDPARAMS if Data is NULL
227  *  D3DERR_VERTEXBUFFEROPTIMIZED if called on an optimized buffer(WineD3D)
228  *
229  *****************************************************************************/
230 static HRESULT WINAPI
231 IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface,
232                                DWORD Flags,
233                                void **Data,
234                                DWORD *Size)
235 {
236     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
237     WINED3DVERTEXBUFFER_DESC Desc;
238     HRESULT hr;
239     TRACE("(%p)->(%08x,%p,%p)\n", This, Flags, Data, Size);
240
241     if(Size)
242     {
243         /* Get the size, for returning it, and for locking */
244         hr = IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer,
245                                           &Desc);
246         if(hr != D3D_OK)
247         {
248             ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr=%08x\n", This, hr);
249             return hr;
250         }
251         *Size = Desc.Size;
252     }
253
254     return IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer,
255                                      0 /* OffsetToLock */,
256                                      0 /* SizeToLock, 0 == Full lock */,
257                                      (BYTE **) Data,
258                                      Flags);
259 }
260
261 static HRESULT WINAPI
262 Thunk_IDirect3DVertexBufferImpl_1_Lock(IDirect3DVertexBuffer *iface,
263                                        DWORD Flags,
264                                        void **Data,
265                                        DWORD *Size)
266 {
267     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
268     TRACE_(ddraw_thunk)("(%p)->(%08x,%p,%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, Flags, Data, Size);
269
270     return IDirect3DVertexBuffer7_Lock(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
271                                        Flags,
272                                        Data,
273                                        Size);
274 }
275
276 /*****************************************************************************
277  * IDirect3DVertexBuffer7::Unlock
278  *
279  * Unlocks a vertex Buffer
280  *
281  * Returns:
282  *  D3D_OK on success
283  *
284  *****************************************************************************/
285 static HRESULT WINAPI
286 IDirect3DVertexBufferImpl_Unlock(IDirect3DVertexBuffer7 *iface)
287 {
288     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
289     TRACE("(%p)->()\n", This);
290
291     /* This is easy :) */
292     return IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer);
293 }
294
295 static HRESULT WINAPI
296 Thunk_IDirect3DVertexBufferImpl_1_Unlock(IDirect3DVertexBuffer *iface)
297 {
298     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
299     TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This);
300
301     return IDirect3DVertexBuffer7_Unlock(ICOM_INTERFACE(This, IDirect3DVertexBuffer7));
302 }
303
304
305 /*****************************************************************************
306  * IDirect3DVertexBuffer7::ProcessVertices
307  *
308  * Processes untransformed Vertices into a transformed or optimized vertex
309  * buffer. It can also perform other operations, such as lighting or clipping
310  *
311  * Params
312  *  VertexOp: Operation(s) to perform: D3DVOP_CLIP, _EXTENTS, _LIGHT, _TRANSFORM
313  *  DestIndex: Index in the destination buffer(This), where the vertices are
314  *             placed
315  *  Count: Number of Vertices in the Source buffer to process
316  *  SrcBuffer: Source vertex buffer
317  *  SrcIndex: Index of the first vertex in the src buffer to process
318  *  D3DDevice: Device to use for transformation
319  *  Flags: 0 for default, D3DPV_DONOTCOPYDATA to prevent copying
320  *         unchaned vertices
321  *
322  * Returns:
323  *  D3D_OK on success
324  *  DDERR_INVALIDPARAMS If D3DVOP_TRANSFORM wasn't passed
325  *
326  *****************************************************************************/
327 static HRESULT WINAPI
328 IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface,
329                                           DWORD VertexOp,
330                                           DWORD DestIndex,
331                                           DWORD Count,
332                                           IDirect3DVertexBuffer7 *SrcBuffer,
333                                           DWORD SrcIndex,
334                                           IDirect3DDevice7 *D3DDevice,
335                                           DWORD Flags)
336 {
337     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
338     IDirect3DVertexBufferImpl *Src = ICOM_OBJECT(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, SrcBuffer);
339     IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice7, D3DDevice);
340     BOOL oldClip, doClip;
341     HRESULT hr;
342     WINED3DVERTEXBUFFER_DESC Desc;
343
344     TRACE("(%p)->(%08x,%d,%d,%p,%d,%p,%08x)\n", This, VertexOp, DestIndex, Count, Src, SrcIndex, D3D, Flags);
345
346     /* Vertex operations:
347      * D3DVOP_CLIP: Clips vertices outside the viewing frustrum. Needs clipping information
348      * in the vertex buffer (Buffer may not be created with D3DVBCAPS_DONOTCLIP)
349      * D3DVOP_EXTENTS: Causes the screen extents to be updated when rendering the vertices
350      * D3DVOP_LIGHT: Lights the vertices
351      * D3DVOP_TRANSFORM: Transform the vertices. This flag is necessary
352      *
353      * WineD3D only transforms and clips the vertices by now, so EXTENTS and LIGHT
354      * are not implemented. Clipping is disabled ATM, because of unsure conditions.
355      */
356     if( !(VertexOp & D3DVOP_TRANSFORM) ) return DDERR_INVALIDPARAMS;
357
358     /* WineD3D doesn't know d3d7 vertex operation, it uses
359      * render states instead. Set the render states according to
360      * the vertex ops
361      */
362     doClip = VertexOp & D3DVOP_CLIP ? TRUE : FALSE;
363     IWineD3DDevice_GetRenderState(D3D->wineD3DDevice,
364                                   WINED3DRS_CLIPPING,
365                                   (DWORD *) &oldClip);
366     if(doClip != oldClip)
367     {
368         IWineD3DDevice_SetRenderState(D3D->wineD3DDevice,
369                                       WINED3DRS_CLIPPING,
370                                       doClip);
371     }
372
373     IWineD3DVertexBuffer_GetDesc(Src->wineD3DVertexBuffer,
374                                  &Desc);
375     IWineD3DDevice_SetStreamSource(D3D->wineD3DDevice,
376                                    0, /* Stream No */
377                                    Src->wineD3DVertexBuffer,
378                                    0, /* Offset */
379                                    get_flexible_vertex_size(Desc.FVF));
380     IWineD3DDevice_SetVertexDeclaration(D3D->wineD3DDevice,
381                                         Src->wineD3DVertexDeclaration);
382     hr = IWineD3DDevice_ProcessVertices(D3D->wineD3DDevice,
383                                         SrcIndex,
384                                         DestIndex,
385                                         Count,
386                                         This->wineD3DVertexBuffer,
387                                         NULL /* Output vdecl */,
388                                         Flags);
389
390     /* Restore the states if needed */
391     if(doClip != oldClip)
392         IWineD3DDevice_SetRenderState(D3D->wineD3DDevice,
393                                       WINED3DRS_CLIPPING,
394                                       oldClip);
395     return hr;
396 }
397
398 static HRESULT WINAPI
399 Thunk_IDirect3DVertexBufferImpl_1_ProcessVertices(IDirect3DVertexBuffer *iface,
400                                                   DWORD VertexOp,
401                                                   DWORD DestIndex,
402                                                   DWORD Count,
403                                                   IDirect3DVertexBuffer *SrcBuffer,
404                                                   DWORD SrcIndex,
405                                                   IDirect3DDevice3 *D3DDevice,
406                                                   DWORD Flags)
407 {
408     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
409     IDirect3DVertexBufferImpl *Src = ICOM_OBJECT(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, SrcBuffer);
410     IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, D3DDevice);
411
412     TRACE_(ddraw_thunk)("(%p)->(%08x,%08x,%08x,%p,%08x,%p,%08x) thunking to IDirect3DVertexBuffer7 interface.\n", This, VertexOp, DestIndex, Count, Src, SrcIndex, D3D, Flags);
413
414     return IDirect3DVertexBuffer7_ProcessVertices(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
415                                                   VertexOp,
416                                                   DestIndex,
417                                                   Count,
418                                                   ICOM_INTERFACE(Src, IDirect3DVertexBuffer7),
419                                                   SrcIndex,
420                                                   ICOM_INTERFACE(D3D, IDirect3DDevice7),
421                                                   Flags);
422 }
423
424 /*****************************************************************************
425  * IDirect3DVertexBuffer7::GetVertexBufferDesc
426  *
427  * Returns the description of a vertex buffer
428  *
429  * Params:
430  *  Desc: Address to write the description to
431  *
432  * Returns
433  *  DDERR_INVALIDPARAMS if Desc is NULL
434  *  D3D_OK on success
435  *
436  *****************************************************************************/
437 static HRESULT WINAPI
438 IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface,
439                                               D3DVERTEXBUFFERDESC *Desc)
440 {
441     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
442     WINED3DVERTEXBUFFER_DESC WDesc;
443     HRESULT hr;
444     DWORD size;
445     TRACE("(%p)->(%p)\n", This, Desc);
446
447     if(!Desc) return DDERR_INVALIDPARAMS;
448
449     hr = IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer,
450                                       &WDesc);
451     if(hr != D3D_OK)
452     {
453         ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr=%08x\n", This, hr);
454         return hr;
455     }
456
457     /* Clear the return value of garbage */
458     size = Desc->dwSize;
459     memset(Desc, 0, size);
460
461     /* Now fill the Desc structure */
462     Desc->dwSize = size;
463     Desc->dwCaps = This->Caps;
464     Desc->dwFVF = WDesc.FVF;
465     Desc->dwNumVertices = WDesc.Size / get_flexible_vertex_size(WDesc.FVF);
466
467     return D3D_OK;
468 }
469
470 static HRESULT WINAPI
471 Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc(IDirect3DVertexBuffer *iface,
472                                                       D3DVERTEXBUFFERDESC *Desc)
473 {
474     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
475     TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, Desc);
476
477     return IDirect3DVertexBuffer7_GetVertexBufferDesc(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
478                                                       Desc);
479 }
480
481
482 /*****************************************************************************
483  * IDirect3DVertexBuffer7::Optimize
484  *
485  * Converts an unoptimized vertex buffer into an optimized buffer
486  *
487  * Params:
488  *  D3DDevice: Device for which this buffer is optimized
489  *  Flags: Not used, should be set to 0
490  *
491  * Returns
492  *  D3D_OK, because it's a stub
493  *
494  *****************************************************************************/
495 static HRESULT WINAPI
496 IDirect3DVertexBufferImpl_Optimize(IDirect3DVertexBuffer7 *iface,
497                                    IDirect3DDevice7 *D3DDevice,
498                                    DWORD Flags)
499 {
500     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
501     IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice7, D3DDevice);
502     FIXME("(%p)->(%p,%08x): stub!\n", This, D3D, Flags);
503
504     /* We could forward this call to WineD3D and take advantage
505      * of it once we use OpenGL vertex buffers
506      */
507     This->Caps |= D3DVBCAPS_OPTIMIZED;
508
509     return DD_OK;
510 }
511
512 static HRESULT WINAPI
513 Thunk_IDirect3DVertexBufferImpl_1_Optimize(IDirect3DVertexBuffer *iface,
514                                            IDirect3DDevice3 *D3DDevice,
515                                            DWORD Flags)
516 {
517     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
518     IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, D3DDevice);
519     TRACE_(ddraw_thunk)("(%p)->(%p,%08x) thunking to IDirect3DVertexBuffer7 interface.\n", This, D3D, Flags);
520
521     return IDirect3DVertexBuffer7_Optimize(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
522                                            ICOM_INTERFACE(D3D, IDirect3DDevice7),
523                                            Flags);
524 }
525
526 /*****************************************************************************
527  * IDirect3DVertexBuffer7::ProcessVerticesStrided
528  *
529  * This method processes untransformed strided vertices into a processed
530  * or optimized vertex buffer.
531  *
532  * For more details on the parameters, see
533  * IDirect3DVertexBuffer7::ProcessVertices
534  *
535  * Params:
536  *  VertexOp: Operations to perform
537  *  DestIndex: Destination index to write the vertices to
538  *  Count: Number of input vertices
539  *  StrideData: Array containing the input vertices
540  *  VertexTypeDesc: Vertex Description or source index?????????
541  *  D3DDevice: IDirect3DDevice7 to use for processing
542  *  Flags: Can be D3DPV_DONOTCOPYDATA to avoid copying unmodified vertices
543  *
544  * Returns
545  *  D3D_OK on success, or DDERR_*
546  *
547  *****************************************************************************/
548 static HRESULT WINAPI
549 IDirect3DVertexBufferImpl_ProcessVerticesStrided(IDirect3DVertexBuffer7 *iface,
550                                                  DWORD VertexOp,
551                                                  DWORD DestIndex,
552                                                  DWORD Count,
553                                                  D3DDRAWPRIMITIVESTRIDEDDATA *StrideData,
554                                                  DWORD VertexTypeDesc,
555                                                  IDirect3DDevice7 *D3DDevice,
556                                                  DWORD Flags)
557 {
558     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
559     IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice7, D3DDevice);
560     FIXME("(%p)->(%08x,%08x,%08x,%p,%08x,%p,%08x): stub!\n", This, VertexOp, DestIndex, Count, StrideData, VertexTypeDesc, D3D, Flags);
561     return DD_OK;
562 }
563
564 /*****************************************************************************
565  * The VTables
566  *****************************************************************************/
567
568 const IDirect3DVertexBuffer7Vtbl IDirect3DVertexBuffer7_Vtbl =
569 {
570     /*** IUnknown Methods ***/
571     IDirect3DVertexBufferImpl_QueryInterface,
572     IDirect3DVertexBufferImpl_AddRef,
573     IDirect3DVertexBufferImpl_Release,
574     /*** IDirect3DVertexBuffer Methods ***/
575     IDirect3DVertexBufferImpl_Lock,
576     IDirect3DVertexBufferImpl_Unlock,
577     IDirect3DVertexBufferImpl_ProcessVertices,
578     IDirect3DVertexBufferImpl_GetVertexBufferDesc,
579     IDirect3DVertexBufferImpl_Optimize,
580     /*** IDirect3DVertexBuffer7 Methods ***/
581     IDirect3DVertexBufferImpl_ProcessVerticesStrided
582 };
583
584 const IDirect3DVertexBufferVtbl IDirect3DVertexBuffer1_Vtbl =
585 {
586     /*** IUnknown Methods ***/
587     Thunk_IDirect3DVertexBufferImpl_1_QueryInterface,
588     Thunk_IDirect3DVertexBufferImpl_1_AddRef,
589     Thunk_IDirect3DVertexBufferImpl_1_Release,
590     /*** IDirect3DVertexBuffer Methods ***/
591     Thunk_IDirect3DVertexBufferImpl_1_Lock,
592     Thunk_IDirect3DVertexBufferImpl_1_Unlock,
593     Thunk_IDirect3DVertexBufferImpl_1_ProcessVertices,
594     Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc,
595     Thunk_IDirect3DVertexBufferImpl_1_Optimize
596 };