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