2 * IDirect3DIndexBuffer8 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
25 #include "wine/debug.h"
27 #include "d3d8_private.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
31 /* IDirect3DIndexBuffer8 IUnknown parts follow: */
32 HRESULT WINAPI IDirect3DIndexBuffer8Impl_QueryInterface(LPDIRECT3DINDEXBUFFER8 iface,REFIID riid,LPVOID *ppobj)
34 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
36 if (IsEqualGUID(riid, &IID_IUnknown)
37 || IsEqualGUID(riid, &IID_IDirect3DResource8)
38 || IsEqualGUID(riid, &IID_IDirect3DIndexBuffer8)) {
39 IDirect3DIndexBuffer8Impl_AddRef(iface);
44 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
48 ULONG WINAPI IDirect3DIndexBuffer8Impl_AddRef(LPDIRECT3DINDEXBUFFER8 iface) {
49 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
50 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
54 ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 iface) {
55 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
56 ULONG ref = --This->ref;
57 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
59 HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
60 HeapFree(GetProcessHeap(), 0, This);
65 /* IDirect3DResource Interface follow: */
66 HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDevice(LPDIRECT3DINDEXBUFFER8 iface, IDirect3DDevice8** ppDevice) {
67 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
68 TRACE("(%p) : returning %p\n", This, This->Device);
69 *ppDevice = (LPDIRECT3DDEVICE8) This->Device;
72 HRESULT WINAPI IDirect3DIndexBuffer8Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
73 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
74 FIXME("(%p) : stub\n", This); return D3D_OK;
76 HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
77 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
78 FIXME("(%p) : stub\n", This); return D3D_OK;
80 HRESULT WINAPI IDirect3DIndexBuffer8Impl_FreePrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid) {
81 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
82 FIXME("(%p) : stub\n", This); return D3D_OK;
84 DWORD WINAPI IDirect3DIndexBuffer8Impl_SetPriority(LPDIRECT3DINDEXBUFFER8 iface, DWORD PriorityNew) {
85 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
86 FIXME("(%p) : stub\n", This); return D3D_OK;
88 DWORD WINAPI IDirect3DIndexBuffer8Impl_GetPriority(LPDIRECT3DINDEXBUFFER8 iface) {
89 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
90 FIXME("(%p) : stub\n", This); return D3D_OK;
92 void WINAPI IDirect3DIndexBuffer8Impl_PreLoad(LPDIRECT3DINDEXBUFFER8 iface) {
93 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
94 FIXME("(%p) : stub\n", This);
96 D3DRESOURCETYPE WINAPI IDirect3DIndexBuffer8Impl_GetType(LPDIRECT3DINDEXBUFFER8 iface) {
97 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
98 TRACE("(%p) : returning %d\n", This, This->ResourceType);
99 return This->ResourceType;
102 /* IDirect3DIndexBuffer8 */
103 HRESULT WINAPI IDirect3DIndexBuffer8Impl_Lock(LPDIRECT3DINDEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags) {
104 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
105 if (OffsetToLock==0) {
106 TRACE("(%p) : no locking yet, offset %d, size %d, Flags=%lx\n", This, OffsetToLock, SizeToLock, Flags);
108 FIXME("(%p) : stub, offset %d, size %d, Flags=%lx\n", This, OffsetToLock, SizeToLock, Flags);
110 *ppbData = (BYTE *)This->allocatedMemory + OffsetToLock;
114 HRESULT WINAPI IDirect3DIndexBuffer8Impl_Unlock(LPDIRECT3DINDEXBUFFER8 iface) {
115 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
116 TRACE("(%p) : stub\n", This);
119 HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDesc(LPDIRECT3DINDEXBUFFER8 iface, D3DINDEXBUFFER_DESC *pDesc) {
120 ICOM_THIS(IDirect3DIndexBuffer8Impl,iface);
122 TRACE("(%p) : copying into %p\n", This, pDesc);
123 memcpy(pDesc, &This->currentDesc, sizeof(D3DINDEXBUFFER_DESC));
127 ICOM_VTABLE(IDirect3DIndexBuffer8) Direct3DIndexBuffer8_Vtbl =
129 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
130 IDirect3DIndexBuffer8Impl_QueryInterface,
131 IDirect3DIndexBuffer8Impl_AddRef,
132 IDirect3DIndexBuffer8Impl_Release,
133 IDirect3DIndexBuffer8Impl_GetDevice,
134 IDirect3DIndexBuffer8Impl_SetPrivateData,
135 IDirect3DIndexBuffer8Impl_GetPrivateData,
136 IDirect3DIndexBuffer8Impl_FreePrivateData,
137 IDirect3DIndexBuffer8Impl_SetPriority,
138 IDirect3DIndexBuffer8Impl_GetPriority,
139 IDirect3DIndexBuffer8Impl_PreLoad,
140 IDirect3DIndexBuffer8Impl_GetType,
141 IDirect3DIndexBuffer8Impl_Lock,
142 IDirect3DIndexBuffer8Impl_Unlock,
143 IDirect3DIndexBuffer8Impl_GetDesc