mshtml: Set focus to FALSE in InPlaceDeactivate.
[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         EnterCriticalSection(&ddraw_cs);
169         /* D3D7 Vertex buffers don't stay bound in the device, they are passed as a parameter
170          * to drawPrimitiveVB. DrawPrimitiveVB sets them as the stream source in wined3d,
171          * and they should get unset there before they are destroyed
172          */
173         IWineD3DDevice_GetStreamSource(This->ddraw->wineD3DDevice,
174                                        0 /* Stream number */,
175                                        &curVB,
176                                        &offset,
177                                        &stride);
178         if(curVB == This->wineD3DVertexBuffer)
179         {
180             IWineD3DDevice_SetStreamSource(This->ddraw->wineD3DDevice,
181                                         0 /* Steam number */,
182                                         NULL /* stream data */,
183                                         0 /* Offset */,
184                                         0 /* stride */);
185         }
186         if(curVB)
187         {
188             IWineD3DVertexBuffer_Release(curVB); /* For the GetStreamSource */
189         }
190
191         IWineD3DVertexDeclaration_Release(This->wineD3DVertexDeclaration);
192         IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
193         LeaveCriticalSection(&ddraw_cs);
194         HeapFree(GetProcessHeap(), 0, This);
195
196         return 0;
197     }
198     return ref;
199 }
200
201 static ULONG WINAPI
202 Thunk_IDirect3DVertexBufferImpl_1_Release(IDirect3DVertexBuffer *iface)
203 {
204     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
205     TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This);
206
207     return IDirect3DVertexBuffer7_Release(ICOM_INTERFACE(This, IDirect3DVertexBuffer7));
208 }
209
210 /*****************************************************************************
211  * IDirect3DVertexBuffer Methods
212  *****************************************************************************/
213
214 /*****************************************************************************
215  * IDirect3DVertexBuffer7::Lock
216  *
217  * Locks the vertex buffer and returns a pointer to the vertex data
218  * Locking vertex buffers is similar to locking surfaces, because Windows
219  * uses surfaces to store vertex data internally (According to the DX sdk)
220  *
221  * Params:
222  *  Flags: Locking flags. Relevant here are DDLOCK_READONLY, DDLOCK_WRITEONLY,
223  *         DDLOCK_DISCARDCONTENTS and DDLOCK_NOOVERWRITE.
224  *  Data:  Returns a pointer to the vertex data
225  *  Size:  Returns the size of the buffer if not NULL
226  *
227  * Returns:
228  *  D3D_OK on success
229  *  DDERR_INVALIDPARAMS if Data is NULL
230  *  D3DERR_VERTEXBUFFEROPTIMIZED if called on an optimized buffer(WineD3D)
231  *
232  *****************************************************************************/
233 static HRESULT WINAPI
234 IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface,
235                                DWORD Flags,
236                                void **Data,
237                                DWORD *Size)
238 {
239     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
240     WINED3DVERTEXBUFFER_DESC Desc;
241     HRESULT hr;
242     TRACE("(%p)->(%08x,%p,%p)\n", This, Flags, Data, Size);
243
244     EnterCriticalSection(&ddraw_cs);
245     if(Size)
246     {
247         /* Get the size, for returning it, and for locking */
248         hr = IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer,
249                                           &Desc);
250         if(hr != D3D_OK)
251         {
252             ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr=%08x\n", This, hr);
253             return hr;
254         }
255         *Size = Desc.Size;
256     }
257
258     hr = IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer,
259                                    0 /* OffsetToLock */,
260                                    0 /* SizeToLock, 0 == Full lock */,
261                                    (BYTE **) Data,
262                                    Flags);
263     LeaveCriticalSection(&ddraw_cs);
264     return hr;
265 }
266
267 static HRESULT WINAPI
268 Thunk_IDirect3DVertexBufferImpl_1_Lock(IDirect3DVertexBuffer *iface,
269                                        DWORD Flags,
270                                        void **Data,
271                                        DWORD *Size)
272 {
273     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
274     TRACE_(ddraw_thunk)("(%p)->(%08x,%p,%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, Flags, Data, Size);
275
276     return IDirect3DVertexBuffer7_Lock(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
277                                        Flags,
278                                        Data,
279                                        Size);
280 }
281
282 /*****************************************************************************
283  * IDirect3DVertexBuffer7::Unlock
284  *
285  * Unlocks a vertex Buffer
286  *
287  * Returns:
288  *  D3D_OK on success
289  *
290  *****************************************************************************/
291 static HRESULT WINAPI
292 IDirect3DVertexBufferImpl_Unlock(IDirect3DVertexBuffer7 *iface)
293 {
294     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
295     HRESULT hr;
296     TRACE("(%p)->()\n", This);
297
298     EnterCriticalSection(&ddraw_cs);
299     hr = IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer);
300     LeaveCriticalSection(&ddraw_cs);
301
302     return hr;
303 }
304
305 static HRESULT WINAPI
306 Thunk_IDirect3DVertexBufferImpl_1_Unlock(IDirect3DVertexBuffer *iface)
307 {
308     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
309     TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", This);
310
311     return IDirect3DVertexBuffer7_Unlock(ICOM_INTERFACE(This, IDirect3DVertexBuffer7));
312 }
313
314
315 /*****************************************************************************
316  * IDirect3DVertexBuffer7::ProcessVertices
317  *
318  * Processes untransformed Vertices into a transformed or optimized vertex
319  * buffer. It can also perform other operations, such as lighting or clipping
320  *
321  * Params
322  *  VertexOp: Operation(s) to perform: D3DVOP_CLIP, _EXTENTS, _LIGHT, _TRANSFORM
323  *  DestIndex: Index in the destination buffer(This), where the vertices are
324  *             placed
325  *  Count: Number of Vertices in the Source buffer to process
326  *  SrcBuffer: Source vertex buffer
327  *  SrcIndex: Index of the first vertex in the src buffer to process
328  *  D3DDevice: Device to use for transformation
329  *  Flags: 0 for default, D3DPV_DONOTCOPYDATA to prevent copying
330  *         unchaned vertices
331  *
332  * Returns:
333  *  D3D_OK on success
334  *  DDERR_INVALIDPARAMS If D3DVOP_TRANSFORM wasn't passed
335  *
336  *****************************************************************************/
337 static HRESULT WINAPI
338 IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface,
339                                           DWORD VertexOp,
340                                           DWORD DestIndex,
341                                           DWORD Count,
342                                           IDirect3DVertexBuffer7 *SrcBuffer,
343                                           DWORD SrcIndex,
344                                           IDirect3DDevice7 *D3DDevice,
345                                           DWORD Flags)
346 {
347     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
348     IDirect3DVertexBufferImpl *Src = ICOM_OBJECT(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, SrcBuffer);
349     IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice7, D3DDevice);
350     BOOL oldClip, doClip;
351     HRESULT hr;
352     WINED3DVERTEXBUFFER_DESC Desc;
353
354     TRACE("(%p)->(%08x,%d,%d,%p,%d,%p,%08x)\n", This, VertexOp, DestIndex, Count, Src, SrcIndex, D3D, Flags);
355
356     /* Vertex operations:
357      * D3DVOP_CLIP: Clips vertices outside the viewing frustrum. Needs clipping information
358      * in the vertex buffer (Buffer may not be created with D3DVBCAPS_DONOTCLIP)
359      * D3DVOP_EXTENTS: Causes the screen extents to be updated when rendering the vertices
360      * D3DVOP_LIGHT: Lights the vertices
361      * D3DVOP_TRANSFORM: Transform the vertices. This flag is necessary
362      *
363      * WineD3D only transforms and clips the vertices by now, so EXTENTS and LIGHT
364      * are not implemented. Clipping is disabled ATM, because of unsure conditions.
365      */
366     if( !(VertexOp & D3DVOP_TRANSFORM) ) return DDERR_INVALIDPARAMS;
367
368     EnterCriticalSection(&ddraw_cs);
369     /* WineD3D doesn't know d3d7 vertex operation, it uses
370      * render states instead. Set the render states according to
371      * the vertex ops
372      */
373     doClip = VertexOp & D3DVOP_CLIP ? TRUE : FALSE;
374     IWineD3DDevice_GetRenderState(D3D->wineD3DDevice,
375                                   WINED3DRS_CLIPPING,
376                                   (DWORD *) &oldClip);
377     if(doClip != oldClip)
378     {
379         IWineD3DDevice_SetRenderState(D3D->wineD3DDevice,
380                                       WINED3DRS_CLIPPING,
381                                       doClip);
382     }
383
384     IWineD3DVertexBuffer_GetDesc(Src->wineD3DVertexBuffer,
385                                  &Desc);
386     IWineD3DDevice_SetStreamSource(D3D->wineD3DDevice,
387                                    0, /* Stream No */
388                                    Src->wineD3DVertexBuffer,
389                                    0, /* Offset */
390                                    get_flexible_vertex_size(Desc.FVF));
391     IWineD3DDevice_SetVertexDeclaration(D3D->wineD3DDevice,
392                                         Src->wineD3DVertexDeclaration);
393     hr = IWineD3DDevice_ProcessVertices(D3D->wineD3DDevice,
394                                         SrcIndex,
395                                         DestIndex,
396                                         Count,
397                                         This->wineD3DVertexBuffer,
398                                         NULL /* Output vdecl */,
399                                         Flags);
400
401     /* Restore the states if needed */
402     if(doClip != oldClip)
403         IWineD3DDevice_SetRenderState(D3D->wineD3DDevice,
404                                       WINED3DRS_CLIPPING,
405                                       oldClip);
406     LeaveCriticalSection(&ddraw_cs);
407     return hr;
408 }
409
410 static HRESULT WINAPI
411 Thunk_IDirect3DVertexBufferImpl_1_ProcessVertices(IDirect3DVertexBuffer *iface,
412                                                   DWORD VertexOp,
413                                                   DWORD DestIndex,
414                                                   DWORD Count,
415                                                   IDirect3DVertexBuffer *SrcBuffer,
416                                                   DWORD SrcIndex,
417                                                   IDirect3DDevice3 *D3DDevice,
418                                                   DWORD Flags)
419 {
420     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
421     IDirect3DVertexBufferImpl *Src = ICOM_OBJECT(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, SrcBuffer);
422     IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, D3DDevice);
423
424     TRACE_(ddraw_thunk)("(%p)->(%08x,%08x,%08x,%p,%08x,%p,%08x) thunking to IDirect3DVertexBuffer7 interface.\n", This, VertexOp, DestIndex, Count, Src, SrcIndex, D3D, Flags);
425
426     return IDirect3DVertexBuffer7_ProcessVertices(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
427                                                   VertexOp,
428                                                   DestIndex,
429                                                   Count,
430                                                   ICOM_INTERFACE(Src, IDirect3DVertexBuffer7),
431                                                   SrcIndex,
432                                                   ICOM_INTERFACE(D3D, IDirect3DDevice7),
433                                                   Flags);
434 }
435
436 /*****************************************************************************
437  * IDirect3DVertexBuffer7::GetVertexBufferDesc
438  *
439  * Returns the description of a vertex buffer
440  *
441  * Params:
442  *  Desc: Address to write the description to
443  *
444  * Returns
445  *  DDERR_INVALIDPARAMS if Desc is NULL
446  *  D3D_OK on success
447  *
448  *****************************************************************************/
449 static HRESULT WINAPI
450 IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface,
451                                               D3DVERTEXBUFFERDESC *Desc)
452 {
453     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
454     WINED3DVERTEXBUFFER_DESC WDesc;
455     HRESULT hr;
456     DWORD size;
457     TRACE("(%p)->(%p)\n", This, Desc);
458
459     if(!Desc) return DDERR_INVALIDPARAMS;
460
461     EnterCriticalSection(&ddraw_cs);
462     hr = IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer,
463                                       &WDesc);
464     if(hr != D3D_OK)
465     {
466         ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr=%08x\n", This, hr);
467         LeaveCriticalSection(&ddraw_cs);
468         return hr;
469     }
470
471     /* Clear the return value of garbage */
472     size = Desc->dwSize;
473     memset(Desc, 0, size);
474
475     /* Now fill the Desc structure */
476     Desc->dwSize = size;
477     Desc->dwCaps = This->Caps;
478     Desc->dwFVF = WDesc.FVF;
479     Desc->dwNumVertices = WDesc.Size / get_flexible_vertex_size(WDesc.FVF);
480     LeaveCriticalSection(&ddraw_cs);
481
482     return D3D_OK;
483 }
484
485 static HRESULT WINAPI
486 Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc(IDirect3DVertexBuffer *iface,
487                                                       D3DVERTEXBUFFERDESC *Desc)
488 {
489     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
490     TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DVertexBuffer7 interface.\n", This, Desc);
491
492     return IDirect3DVertexBuffer7_GetVertexBufferDesc(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
493                                                       Desc);
494 }
495
496
497 /*****************************************************************************
498  * IDirect3DVertexBuffer7::Optimize
499  *
500  * Converts an unoptimized vertex buffer into an optimized buffer
501  *
502  * Params:
503  *  D3DDevice: Device for which this buffer is optimized
504  *  Flags: Not used, should be set to 0
505  *
506  * Returns
507  *  D3D_OK, because it's a stub
508  *
509  *****************************************************************************/
510 static HRESULT WINAPI
511 IDirect3DVertexBufferImpl_Optimize(IDirect3DVertexBuffer7 *iface,
512                                    IDirect3DDevice7 *D3DDevice,
513                                    DWORD Flags)
514 {
515     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
516     IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice7, D3DDevice);
517     FIXME("(%p)->(%p,%08x): stub!\n", This, D3D, Flags);
518
519     /* We could forward this call to WineD3D and take advantage
520      * of it once we use OpenGL vertex buffers
521      */
522     EnterCriticalSection(&ddraw_cs);
523     This->Caps |= D3DVBCAPS_OPTIMIZED;
524     LeaveCriticalSection(&ddraw_cs);
525
526     return DD_OK;
527 }
528
529 static HRESULT WINAPI
530 Thunk_IDirect3DVertexBufferImpl_1_Optimize(IDirect3DVertexBuffer *iface,
531                                            IDirect3DDevice3 *D3DDevice,
532                                            DWORD Flags)
533 {
534     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
535     IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, D3DDevice);
536     TRACE_(ddraw_thunk)("(%p)->(%p,%08x) thunking to IDirect3DVertexBuffer7 interface.\n", This, D3D, Flags);
537
538     return IDirect3DVertexBuffer7_Optimize(ICOM_INTERFACE(This, IDirect3DVertexBuffer7),
539                                            ICOM_INTERFACE(D3D, IDirect3DDevice7),
540                                            Flags);
541 }
542
543 /*****************************************************************************
544  * IDirect3DVertexBuffer7::ProcessVerticesStrided
545  *
546  * This method processes untransformed strided vertices into a processed
547  * or optimized vertex buffer.
548  *
549  * For more details on the parameters, see
550  * IDirect3DVertexBuffer7::ProcessVertices
551  *
552  * Params:
553  *  VertexOp: Operations to perform
554  *  DestIndex: Destination index to write the vertices to
555  *  Count: Number of input vertices
556  *  StrideData: Array containing the input vertices
557  *  VertexTypeDesc: Vertex Description or source index?????????
558  *  D3DDevice: IDirect3DDevice7 to use for processing
559  *  Flags: Can be D3DPV_DONOTCOPYDATA to avoid copying unmodified vertices
560  *
561  * Returns
562  *  D3D_OK on success, or DDERR_*
563  *
564  *****************************************************************************/
565 static HRESULT WINAPI
566 IDirect3DVertexBufferImpl_ProcessVerticesStrided(IDirect3DVertexBuffer7 *iface,
567                                                  DWORD VertexOp,
568                                                  DWORD DestIndex,
569                                                  DWORD Count,
570                                                  D3DDRAWPRIMITIVESTRIDEDDATA *StrideData,
571                                                  DWORD VertexTypeDesc,
572                                                  IDirect3DDevice7 *D3DDevice,
573                                                  DWORD Flags)
574 {
575     ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
576     IDirect3DDeviceImpl *D3D = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice7, D3DDevice);
577     FIXME("(%p)->(%08x,%08x,%08x,%p,%08x,%p,%08x): stub!\n", This, VertexOp, DestIndex, Count, StrideData, VertexTypeDesc, D3D, Flags);
578     return DD_OK;
579 }
580
581 /*****************************************************************************
582  * The VTables
583  *****************************************************************************/
584
585 const IDirect3DVertexBuffer7Vtbl IDirect3DVertexBuffer7_Vtbl =
586 {
587     /*** IUnknown Methods ***/
588     IDirect3DVertexBufferImpl_QueryInterface,
589     IDirect3DVertexBufferImpl_AddRef,
590     IDirect3DVertexBufferImpl_Release,
591     /*** IDirect3DVertexBuffer Methods ***/
592     IDirect3DVertexBufferImpl_Lock,
593     IDirect3DVertexBufferImpl_Unlock,
594     IDirect3DVertexBufferImpl_ProcessVertices,
595     IDirect3DVertexBufferImpl_GetVertexBufferDesc,
596     IDirect3DVertexBufferImpl_Optimize,
597     /*** IDirect3DVertexBuffer7 Methods ***/
598     IDirect3DVertexBufferImpl_ProcessVerticesStrided
599 };
600
601 const IDirect3DVertexBufferVtbl IDirect3DVertexBuffer1_Vtbl =
602 {
603     /*** IUnknown Methods ***/
604     Thunk_IDirect3DVertexBufferImpl_1_QueryInterface,
605     Thunk_IDirect3DVertexBufferImpl_1_AddRef,
606     Thunk_IDirect3DVertexBufferImpl_1_Release,
607     /*** IDirect3DVertexBuffer Methods ***/
608     Thunk_IDirect3DVertexBufferImpl_1_Lock,
609     Thunk_IDirect3DVertexBufferImpl_1_Unlock,
610     Thunk_IDirect3DVertexBufferImpl_1_ProcessVertices,
611     Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc,
612     Thunk_IDirect3DVertexBufferImpl_1_Optimize
613 };