2 * IWineD3DIndexBuffer Implementation
4 * Copyright 2002-2004 Jason Edmeades
5 * Copyright 2003-2004 Raphael Junqueira
6 * Copyright 2004 Christian Costa
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "wined3d_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3d
);
27 #define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info
29 /* *******************************************
30 IWineD3DIndexBuffer IUnknown parts follow
31 ******************************************* */
32 HRESULT WINAPI
IWineD3DIndexBufferImpl_QueryInterface(IWineD3DIndexBuffer
*iface
, REFIID riid
, LPVOID
*ppobj
)
34 IWineD3DIndexBufferImpl
*This
= (IWineD3DIndexBufferImpl
*)iface
;
35 WARN("(%p)->(%s,%p) should not be called\n",This
,debugstr_guid(riid
),ppobj
);
39 ULONG WINAPI
IWineD3DIndexBufferImpl_AddRef(IWineD3DIndexBuffer
*iface
) {
40 IWineD3DIndexBufferImpl
*This
= (IWineD3DIndexBufferImpl
*)iface
;
41 TRACE("(%p) : AddRef increasing from %ld\n", This
, This
->resource
.ref
);
42 IUnknown_AddRef(This
->resource
.parent
);
43 return InterlockedIncrement(&This
->resource
.ref
);
46 ULONG WINAPI
IWineD3DIndexBufferImpl_Release(IWineD3DIndexBuffer
*iface
) {
47 IWineD3DIndexBufferImpl
*This
= (IWineD3DIndexBufferImpl
*)iface
;
49 TRACE("(%p) : Releasing from %ld\n", This
, This
->resource
.ref
);
50 ref
= InterlockedDecrement(&This
->resource
.ref
);
52 HeapFree(GetProcessHeap(), 0, This
->allocatedMemory
);
53 IWineD3DDevice_Release(This
->resource
.wineD3DDevice
);
54 HeapFree(GetProcessHeap(), 0, This
);
56 IUnknown_Release(This
->resource
.parent
); /* Released the reference to the d3dx object */
61 /* ****************************************************
62 IWineD3DIndexBuffer IWineD3DResource parts follow
63 **************************************************** */
64 HRESULT WINAPI
IWineD3DIndexBufferImpl_GetDevice(IWineD3DIndexBuffer
*iface
, IWineD3DDevice
** ppDevice
) {
65 return IWineD3DResource_GetDevice((IWineD3DResource
*)iface
, ppDevice
);
68 HRESULT WINAPI
IWineD3DIndexBufferImpl_SetPrivateData(IWineD3DIndexBuffer
*iface
, REFGUID refguid
, CONST
void* pData
, DWORD SizeOfData
, DWORD Flags
) {
69 return IWineD3DResource_SetPrivateData((IWineD3DResource
*)iface
, refguid
, pData
, SizeOfData
, Flags
);
72 HRESULT WINAPI
IWineD3DIndexBufferImpl_GetPrivateData(IWineD3DIndexBuffer
*iface
, REFGUID refguid
, void* pData
, DWORD
* pSizeOfData
) {
73 return IWineD3DResource_GetPrivateData((IWineD3DResource
*)iface
, refguid
, pData
, pSizeOfData
);
76 HRESULT WINAPI
IWineD3DIndexBufferImpl_FreePrivateData(IWineD3DIndexBuffer
*iface
, REFGUID refguid
) {
77 return IWineD3DResource_FreePrivateData((IWineD3DResource
*)iface
, refguid
);
80 DWORD WINAPI
IWineD3DIndexBufferImpl_SetPriority(IWineD3DIndexBuffer
*iface
, DWORD PriorityNew
) {
81 return IWineD3DResource_SetPriority((IWineD3DResource
*)iface
, PriorityNew
);
84 DWORD WINAPI
IWineD3DIndexBufferImpl_GetPriority(IWineD3DIndexBuffer
*iface
) {
85 return IWineD3DResource_GetPriority((IWineD3DResource
*)iface
);
88 void WINAPI
IWineD3DIndexBufferImpl_PreLoad(IWineD3DIndexBuffer
*iface
) {
89 return IWineD3DResource_PreLoad((IWineD3DResource
*)iface
);
92 D3DRESOURCETYPE WINAPI
IWineD3DIndexBufferImpl_GetType(IWineD3DIndexBuffer
*iface
) {
93 return IWineD3DResource_GetType((IWineD3DResource
*)iface
);
96 HRESULT WINAPI
IWineD3DIndexBufferImpl_GetParent(IWineD3DIndexBuffer
*iface
, IUnknown
**pParent
) {
97 return IWineD3DResource_GetParent((IWineD3DResource
*)iface
, pParent
);
100 /* ******************************************************
101 IWineD3DIndexBuffer IWineD3DIndexBuffer parts follow
102 ****************************************************** */
103 HRESULT WINAPI
IWineD3DIndexBufferImpl_Lock(IWineD3DIndexBuffer
*iface
, UINT OffsetToLock
, UINT SizeToLock
, BYTE
** ppbData
, DWORD Flags
) {
104 IWineD3DIndexBufferImpl
*This
= (IWineD3DIndexBufferImpl
*)iface
;
105 TRACE("(%p) : no real locking yet, offset %d, size %d, Flags=%lx\n", This
, OffsetToLock
, SizeToLock
, Flags
);
106 *ppbData
= (BYTE
*)This
->allocatedMemory
+ OffsetToLock
;
109 HRESULT WINAPI
IWineD3DIndexBufferImpl_Unlock(IWineD3DIndexBuffer
*iface
) {
110 IWineD3DIndexBufferImpl
*This
= (IWineD3DIndexBufferImpl
*)iface
;
111 TRACE("(%p) : stub\n", This
);
114 HRESULT WINAPI
IWineD3DIndexBufferImpl_GetDesc(IWineD3DIndexBuffer
*iface
, D3DINDEXBUFFER_DESC
*pDesc
) {
115 IWineD3DIndexBufferImpl
*This
= (IWineD3DIndexBufferImpl
*)iface
;
117 TRACE("(%p)\n", This
);
118 pDesc
->Format
= This
->currentDesc
.Format
;
119 pDesc
->Type
= This
->resource
.resourceType
;
120 pDesc
->Usage
= This
->currentDesc
.Usage
;
121 pDesc
->Pool
= This
->currentDesc
.Pool
;
122 pDesc
->Size
= This
->currentDesc
.Size
;
126 IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl
=
128 IWineD3DIndexBufferImpl_QueryInterface
,
129 IWineD3DIndexBufferImpl_AddRef
,
130 IWineD3DIndexBufferImpl_Release
,
131 IWineD3DIndexBufferImpl_GetParent
,
132 IWineD3DIndexBufferImpl_GetDevice
,
133 IWineD3DIndexBufferImpl_SetPrivateData
,
134 IWineD3DIndexBufferImpl_GetPrivateData
,
135 IWineD3DIndexBufferImpl_FreePrivateData
,
136 IWineD3DIndexBufferImpl_SetPriority
,
137 IWineD3DIndexBufferImpl_GetPriority
,
138 IWineD3DIndexBufferImpl_PreLoad
,
139 IWineD3DIndexBufferImpl_GetType
,
140 IWineD3DIndexBufferImpl_Lock
,
141 IWineD3DIndexBufferImpl_Unlock
,
142 IWineD3DIndexBufferImpl_GetDesc