crypt32: Fix a cast for Win64.
[wine/multimedia.git] / dlls / d3d8 / vertexbuffer.c
blob4ad5fd6aac189356b0df27b0c6a7fa93445be7df
1 /*
2 * IDirect3DVertexBuffer8 implementation
4 * Copyright 2005 Oliver Stieber
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.
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.
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
21 #include "config.h"
22 #include "d3d8_private.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
26 /* IDirect3DVertexBuffer8 IUnknown parts follow: */
27 static HRESULT WINAPI IDirect3DVertexBuffer8Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER8 iface, REFIID riid, LPVOID *ppobj) {
28 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
30 if (IsEqualGUID(riid, &IID_IUnknown)
31 || IsEqualGUID(riid, &IID_IDirect3DResource8)
32 || IsEqualGUID(riid, &IID_IDirect3DVertexBuffer8)) {
33 IUnknown_AddRef(iface);
34 *ppobj = This;
35 return S_OK;
38 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
40 *ppobj = NULL;
41 return E_NOINTERFACE;
44 static ULONG WINAPI IDirect3DVertexBuffer8Impl_AddRef(LPDIRECT3DVERTEXBUFFER8 iface) {
45 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
46 ULONG ref = InterlockedIncrement(&This->ref);
48 TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
50 return ref;
53 static ULONG WINAPI IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 iface) {
54 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
55 ULONG ref = InterlockedDecrement(&This->ref);
57 TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
59 if (ref == 0) {
60 IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
61 IUnknown_Release(This->parentDevice);
62 HeapFree(GetProcessHeap(), 0, This);
65 return ref;
68 /* IDirect3DVertexBuffer8 IDirect3DResource8 Interface follow: */
69 static HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDevice(LPDIRECT3DVERTEXBUFFER8 iface, IDirect3DDevice8 **ppDevice) {
70 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
71 TRACE("(%p) Relay\n", This);
73 return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice);
76 static HRESULT WINAPI IDirect3DVertexBuffer8Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) {
77 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
78 TRACE("(%p) Relay\n", This);
80 return IWineD3DVertexBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags);
83 static HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) {
84 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
85 TRACE("(%p) Relay\n", This);
87 return IWineD3DVertexBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData);
90 static HRESULT WINAPI IDirect3DVertexBuffer8Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid) {
91 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
92 TRACE("(%p) Relay\n", This);
94 return IWineD3DVertexBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid);
97 static DWORD WINAPI IDirect3DVertexBuffer8Impl_SetPriority(LPDIRECT3DVERTEXBUFFER8 iface, DWORD PriorityNew) {
98 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
99 TRACE("(%p) Relay\n", This);
101 return IWineD3DVertexBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew);
104 static DWORD WINAPI IDirect3DVertexBuffer8Impl_GetPriority(LPDIRECT3DVERTEXBUFFER8 iface) {
105 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
106 TRACE("(%p) Relay\n", This);
108 return IWineD3DVertexBuffer_GetPriority(This->wineD3DVertexBuffer);
111 static void WINAPI IDirect3DVertexBuffer8Impl_PreLoad(LPDIRECT3DVERTEXBUFFER8 iface) {
112 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
113 TRACE("(%p) Relay\n", This);
114 IWineD3DVertexBuffer_PreLoad(This->wineD3DVertexBuffer);
116 return;
119 static D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer8Impl_GetType(LPDIRECT3DVERTEXBUFFER8 iface) {
120 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
121 TRACE("(%p) Relay\n", This);
123 return IWineD3DVertexBuffer_GetType(This->wineD3DVertexBuffer);
126 /* IDirect3DVertexBuffer8 Interface follow: */
127 static HRESULT WINAPI IDirect3DVertexBuffer8Impl_Lock(LPDIRECT3DVERTEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE **ppbData, DWORD Flags) {
128 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
129 TRACE("(%p) Relay\n", This);
131 return IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, ppbData, Flags);
134 static HRESULT WINAPI IDirect3DVertexBuffer8Impl_Unlock(LPDIRECT3DVERTEXBUFFER8 iface) {
135 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
136 TRACE("(%p) Relay\n", This);
138 return IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer);
141 static HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDesc(LPDIRECT3DVERTEXBUFFER8 iface, D3DVERTEXBUFFER_DESC *pDesc) {
142 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
143 TRACE("(%p) Relay\n", This);
145 return IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer, (WINED3DVERTEXBUFFER_DESC *) pDesc);
148 const IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl =
150 /* IUnknown */
151 IDirect3DVertexBuffer8Impl_QueryInterface,
152 IDirect3DVertexBuffer8Impl_AddRef,
153 IDirect3DVertexBuffer8Impl_Release,
154 /* IDirect3DResource8 */
155 IDirect3DVertexBuffer8Impl_GetDevice,
156 IDirect3DVertexBuffer8Impl_SetPrivateData,
157 IDirect3DVertexBuffer8Impl_GetPrivateData,
158 IDirect3DVertexBuffer8Impl_FreePrivateData,
159 IDirect3DVertexBuffer8Impl_SetPriority,
160 IDirect3DVertexBuffer8Impl_GetPriority,
161 IDirect3DVertexBuffer8Impl_PreLoad,
162 IDirect3DVertexBuffer8Impl_GetType,
163 /* IDirect3DVertexBuffer8 */
164 IDirect3DVertexBuffer8Impl_Lock,
165 IDirect3DVertexBuffer8Impl_Unlock,
166 IDirect3DVertexBuffer8Impl_GetDesc