Change SHChangeNotify to be Unicode and ANSI indifferent, as the type
[wine] / dlls / d3d8 / vertexbuffer.c
1 /*
2  * IDirect3DResource8 implementation
3  *
4  * Copyright 2002 Jason Edmeades
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include "windef.h"
22 #include "winbase.h"
23 #include "winuser.h"
24 #include "wingdi.h"
25 #include "wine/debug.h"
26
27 #include "d3d8_private.h"
28
29 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
30
31 /* IDirect3DResource IUnknown parts follow: */
32 HRESULT WINAPI IDirect3DVertexBuffer8Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER8 iface, REFIID riid, LPVOID *ppobj)
33 {
34     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
35
36     if (IsEqualGUID(riid, &IID_IUnknown)
37         || IsEqualGUID(riid, &IID_IDirect3DResource8)
38         || IsEqualGUID(riid, &IID_IDirect3DVertexBuffer8)) {
39         IDirect3DVertexBuffer8Impl_AddRef(iface);
40         *ppobj = This;
41         return D3D_OK;
42     }
43
44     WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
45     return E_NOINTERFACE;
46 }
47
48 ULONG WINAPI IDirect3DVertexBuffer8Impl_AddRef(LPDIRECT3DVERTEXBUFFER8 iface) {
49     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
50     TRACE("(%p) : AddRef from %ld\n", This, This->ref);
51     return ++(This->ref);
52 }
53
54 ULONG WINAPI IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 iface) {
55     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
56     ULONG ref = --This->ref;
57     TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
58     if (ref == 0) {
59         if (NULL != This->allocatedMemory) HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
60         HeapFree(GetProcessHeap(), 0, This);
61     }
62     return ref;
63 }
64
65 /* IDirect3DResource Interface follow: */
66 HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_GetDevice(LPDIRECT3DVERTEXBUFFER8 iface, IDirect3DDevice8** ppDevice) {
67     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
68     TRACE("(%p) : returning %p\n", This, This->Device);
69     *ppDevice = (LPDIRECT3DDEVICE8) This->Device;
70     return D3D_OK;
71 }
72 HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
73     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
74     FIXME("(%p) : stub\n", This);    return D3D_OK;
75 }
76 HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
77     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
78     FIXME("(%p) : stub\n", This);    return D3D_OK;
79 }
80 HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid) {
81     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
82     FIXME("(%p) : stub\n", This);    return D3D_OK;
83 }
84 DWORD    WINAPI        IDirect3DVertexBuffer8Impl_SetPriority(LPDIRECT3DVERTEXBUFFER8 iface, DWORD PriorityNew) {
85     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
86     FIXME("(%p) : stub\n", This);    return D3D_OK;
87 }
88 DWORD    WINAPI        IDirect3DVertexBuffer8Impl_GetPriority(LPDIRECT3DVERTEXBUFFER8 iface) {
89     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
90     FIXME("(%p) : stub\n", This);    return D3D_OK;
91 }
92 void     WINAPI        IDirect3DVertexBuffer8Impl_PreLoad(LPDIRECT3DVERTEXBUFFER8 iface) {
93     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
94     FIXME("(%p) : stub\n", This);
95 }
96 D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer8Impl_GetType(LPDIRECT3DVERTEXBUFFER8 iface) {
97     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
98     TRACE("(%p) : returning %d\n", This, This->ResourceType);
99     return This->ResourceType;
100 }
101
102 /* IDirect3DVertexBuffer8 */
103 HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_Lock(LPDIRECT3DVERTEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags) {
104     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
105     TRACE("(%p) : returning memory of %p (base:%p,offset:%u)\n", This, This->allocatedMemory + OffsetToLock, This->allocatedMemory, OffsetToLock);
106     /* TODO: check Flags compatibility with This->currentDesc.Usage (see MSDN) */
107     *ppbData = This->allocatedMemory + OffsetToLock;
108     return D3D_OK;
109 }
110 HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_Unlock(LPDIRECT3DVERTEXBUFFER8 iface) {
111     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
112     TRACE("(%p) : stub\n", This);
113     return D3D_OK;
114 }
115 HRESULT  WINAPI        IDirect3DVertexBuffer8Impl_GetDesc(LPDIRECT3DVERTEXBUFFER8 iface, D3DVERTEXBUFFER_DESC *pDesc) {
116     ICOM_THIS(IDirect3DVertexBuffer8Impl,iface);
117
118     TRACE("(%p)\n", This);
119     pDesc->Format= This->currentDesc.Format;
120     pDesc->Type=   This->currentDesc.Type;
121     pDesc->Usage=  This->currentDesc.Usage;
122     pDesc->Pool=   This->currentDesc.Pool;
123     pDesc->Size=   This->currentDesc.Size;
124     pDesc->FVF=    This->currentDesc.FVF;
125     return D3D_OK;
126 }
127
128 ICOM_VTABLE(IDirect3DVertexBuffer8) Direct3DVertexBuffer8_Vtbl =
129 {
130     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
131     IDirect3DVertexBuffer8Impl_QueryInterface,
132     IDirect3DVertexBuffer8Impl_AddRef,
133     IDirect3DVertexBuffer8Impl_Release,
134     IDirect3DVertexBuffer8Impl_GetDevice,
135     IDirect3DVertexBuffer8Impl_SetPrivateData,
136     IDirect3DVertexBuffer8Impl_GetPrivateData,
137     IDirect3DVertexBuffer8Impl_FreePrivateData,
138     IDirect3DVertexBuffer8Impl_SetPriority,
139     IDirect3DVertexBuffer8Impl_GetPriority,
140     IDirect3DVertexBuffer8Impl_PreLoad,
141     IDirect3DVertexBuffer8Impl_GetType,
142     IDirect3DVertexBuffer8Impl_Lock,
143     IDirect3DVertexBuffer8Impl_Unlock,
144     IDirect3DVertexBuffer8Impl_GetDesc
145 };