Add support for HCBT_SYSCOMMAND hook, add logging for HCBT_SYSCOMMAND
[wine.git] / dlls / d3d8 / vertexbuffer.c
blob4129bd165fd2db3abff132bfcf9d81dc3f936a13
1 /*
2 * IDirect3DResource8 implementation
4 * Copyright 2002 Jason Edmeades
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "wingdi.h"
29 #include "wine/debug.h"
31 #include "d3d8_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
35 /* IDirect3DResource IUnknown parts follow: */
36 HRESULT WINAPI IDirect3DVertexBuffer8Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER8 iface, REFIID riid, LPVOID *ppobj)
38 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
40 if (IsEqualGUID(riid, &IID_IUnknown)
41 || IsEqualGUID(riid, &IID_IDirect3DResource8)
42 || IsEqualGUID(riid, &IID_IDirect3DVertexBuffer8)) {
43 IDirect3DVertexBuffer8Impl_AddRef(iface);
44 *ppobj = This;
45 return D3D_OK;
48 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
49 return E_NOINTERFACE;
52 ULONG WINAPI IDirect3DVertexBuffer8Impl_AddRef(LPDIRECT3DVERTEXBUFFER8 iface) {
53 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
54 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
55 return ++(This->ref);
58 ULONG WINAPI IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 iface) {
59 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
60 ULONG ref = --This->ref;
61 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
62 if (ref == 0) {
63 if (NULL != This->allocatedMemory) HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
64 HeapFree(GetProcessHeap(), 0, This);
66 return ref;
69 /* IDirect3DResource Interface follow: */
70 HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDevice(LPDIRECT3DVERTEXBUFFER8 iface, IDirect3DDevice8** ppDevice) {
71 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
72 TRACE("(%p) : returning %p\n", This, This->Device);
73 *ppDevice = (LPDIRECT3DDEVICE8) This->Device;
74 IDirect3DDevice8Impl_AddRef(*ppDevice);
75 return D3D_OK;
77 HRESULT WINAPI IDirect3DVertexBuffer8Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
78 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
79 FIXME("(%p) : stub\n", This); return D3D_OK;
81 HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
82 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
83 FIXME("(%p) : stub\n", This); return D3D_OK;
85 HRESULT WINAPI IDirect3DVertexBuffer8Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid) {
86 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
87 FIXME("(%p) : stub\n", This); return D3D_OK;
89 DWORD WINAPI IDirect3DVertexBuffer8Impl_SetPriority(LPDIRECT3DVERTEXBUFFER8 iface, DWORD PriorityNew) {
90 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
91 FIXME("(%p) : stub\n", This); return D3D_OK;
93 DWORD WINAPI IDirect3DVertexBuffer8Impl_GetPriority(LPDIRECT3DVERTEXBUFFER8 iface) {
94 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
95 FIXME("(%p) : stub\n", This); return D3D_OK;
97 void WINAPI IDirect3DVertexBuffer8Impl_PreLoad(LPDIRECT3DVERTEXBUFFER8 iface) {
98 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
99 FIXME("(%p) : stub\n", This);
101 D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer8Impl_GetType(LPDIRECT3DVERTEXBUFFER8 iface) {
102 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
103 TRACE("(%p) : returning %d\n", This, This->ResourceType);
104 return This->ResourceType;
107 /* IDirect3DVertexBuffer8 */
108 HRESULT WINAPI IDirect3DVertexBuffer8Impl_Lock(LPDIRECT3DVERTEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags) {
109 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
110 TRACE("(%p) : returning memory of %p (base:%p,offset:%u)\n", This, This->allocatedMemory + OffsetToLock, This->allocatedMemory, OffsetToLock);
111 /* TODO: check Flags compatibility with This->currentDesc.Usage (see MSDN) */
112 *ppbData = This->allocatedMemory + OffsetToLock;
113 return D3D_OK;
115 HRESULT WINAPI IDirect3DVertexBuffer8Impl_Unlock(LPDIRECT3DVERTEXBUFFER8 iface) {
116 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
117 TRACE("(%p) : stub\n", This);
118 return D3D_OK;
120 HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDesc(LPDIRECT3DVERTEXBUFFER8 iface, D3DVERTEXBUFFER_DESC *pDesc) {
121 IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
123 TRACE("(%p)\n", This);
124 pDesc->Format = This->currentDesc.Format;
125 pDesc->Type = This->currentDesc.Type;
126 pDesc->Usage = This->currentDesc.Usage;
127 pDesc->Pool = This->currentDesc.Pool;
128 pDesc->Size = This->currentDesc.Size;
129 pDesc->FVF = This->currentDesc.FVF;
130 return D3D_OK;
133 IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl =
135 IDirect3DVertexBuffer8Impl_QueryInterface,
136 IDirect3DVertexBuffer8Impl_AddRef,
137 IDirect3DVertexBuffer8Impl_Release,
138 IDirect3DVertexBuffer8Impl_GetDevice,
139 IDirect3DVertexBuffer8Impl_SetPrivateData,
140 IDirect3DVertexBuffer8Impl_GetPrivateData,
141 IDirect3DVertexBuffer8Impl_FreePrivateData,
142 IDirect3DVertexBuffer8Impl_SetPriority,
143 IDirect3DVertexBuffer8Impl_GetPriority,
144 IDirect3DVertexBuffer8Impl_PreLoad,
145 IDirect3DVertexBuffer8Impl_GetType,
146 IDirect3DVertexBuffer8Impl_Lock,
147 IDirect3DVertexBuffer8Impl_Unlock,
148 IDirect3DVertexBuffer8Impl_GetDesc