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
29 #include "wine/debug.h"
31 #include "d3d8_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(d3d
);
35 /* IDirect3DResource IUnknown parts follow: */
36 HRESULT WINAPI
IDirect3DResource8Impl_QueryInterface(LPDIRECT3DRESOURCE8 iface
,REFIID riid
,LPVOID
*ppobj
)
38 ICOM_THIS(IDirect3DResource8Impl
,iface
);
40 if (IsEqualGUID(riid
, &IID_IUnknown
)
41 || IsEqualGUID(riid
, &IID_IDirect3DResource8
)) {
42 IDirect3DResource8Impl_AddRef(iface
);
47 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
51 ULONG WINAPI
IDirect3DResource8Impl_AddRef(LPDIRECT3DRESOURCE8 iface
) {
52 ICOM_THIS(IDirect3DResource8Impl
,iface
);
53 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
57 ULONG WINAPI
IDirect3DResource8Impl_Release(LPDIRECT3DRESOURCE8 iface
) {
58 ICOM_THIS(IDirect3DResource8Impl
,iface
);
59 ULONG ref
= --This
->ref
;
60 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
62 HeapFree(GetProcessHeap(), 0, This
);
66 /* IDirect3DResource Interface follow: */
67 HRESULT WINAPI
IDirect3DResource8Impl_GetDevice(LPDIRECT3DRESOURCE8 iface
, IDirect3DDevice8
** ppDevice
) {
68 ICOM_THIS(IDirect3DResource8Impl
,iface
);
69 TRACE("(%p) : returning %p\n", This
, This
->Device
);
70 *ppDevice
= (LPDIRECT3DDEVICE8
) This
->Device
;
71 IDirect3DDevice8Impl_AddRef(*ppDevice
);
74 HRESULT WINAPI
IDirect3DResource8Impl_SetPrivateData(LPDIRECT3DRESOURCE8 iface
, REFGUID refguid
, CONST
void* pData
, DWORD SizeOfData
, DWORD Flags
) {
75 ICOM_THIS(IDirect3DResource8Impl
,iface
);
76 FIXME("(%p) : stub\n", This
); return D3D_OK
;
78 HRESULT WINAPI
IDirect3DResource8Impl_GetPrivateData(LPDIRECT3DRESOURCE8 iface
, REFGUID refguid
, void* pData
, DWORD
* pSizeOfData
) {
79 ICOM_THIS(IDirect3DResource8Impl
,iface
);
80 FIXME("(%p) : stub\n", This
); return D3D_OK
;
82 HRESULT WINAPI
IDirect3DResource8Impl_FreePrivateData(LPDIRECT3DRESOURCE8 iface
, REFGUID refguid
) {
83 ICOM_THIS(IDirect3DResource8Impl
,iface
);
84 FIXME("(%p) : stub\n", This
); return D3D_OK
;
86 DWORD WINAPI
IDirect3DResource8Impl_SetPriority(LPDIRECT3DRESOURCE8 iface
, DWORD PriorityNew
) {
87 ICOM_THIS(IDirect3DResource8Impl
,iface
);
88 FIXME("(%p) : stub\n", This
);
91 DWORD WINAPI
IDirect3DResource8Impl_GetPriority(LPDIRECT3DRESOURCE8 iface
) {
92 ICOM_THIS(IDirect3DResource8Impl
,iface
);
93 FIXME("(%p) : stub\n", This
);
96 void WINAPI
IDirect3DResource8Impl_PreLoad(LPDIRECT3DRESOURCE8 iface
) {
97 ICOM_THIS(IDirect3DResource8Impl
,iface
);
98 FIXME("(%p) : stub\n", This
);
100 D3DRESOURCETYPE WINAPI
IDirect3DResource8Impl_GetType(LPDIRECT3DRESOURCE8 iface
) {
101 ICOM_THIS(IDirect3DResource8Impl
,iface
);
102 TRACE("(%p) : returning %d\n", This
, This
->ResourceType
);
103 return This
->ResourceType
;
106 D3DPOOL WINAPI
IDirect3DResource8Impl_GetPool(LPDIRECT3DRESOURCE8 iface
) {
107 ICOM_THIS(IDirect3DResource8Impl
,iface
);
109 switch (This
->ResourceType
) {
110 case D3DRTYPE_SURFACE
:
111 return ((IDirect3DSurface8Impl
*) This
)->myDesc
.Pool
;
112 case D3DRTYPE_TEXTURE
:
113 return ((IDirect3DTexture8Impl
*) This
)->surfaces
[0]->myDesc
.Pool
;
114 case D3DRTYPE_VOLUME
:
115 return ((IDirect3DVolume8Impl
*) This
)->myDesc
.Pool
;
116 case D3DRTYPE_VOLUMETEXTURE
:
117 return ((IDirect3DVolumeTexture8Impl
*) This
)->volumes
[0]->myDesc
.Pool
;
118 case D3DRTYPE_CUBETEXTURE
:
119 return ((IDirect3DCubeTexture8Impl
*) This
)->surfaces
[0][0]->myDesc
.Pool
;
120 case D3DRTYPE_VERTEXBUFFER
:
121 return ((IDirect3DVertexBuffer8Impl
*) This
)->currentDesc
.Pool
;
122 case D3DRTYPE_INDEXBUFFER
:
123 return ((IDirect3DIndexBuffer8Impl
*) This
)->currentDesc
.Pool
;
125 FIXME("(%p) Unrecognized type(%d,%s)\n", This
, This
->ResourceType
, debug_d3dressourcetype(This
->ResourceType
));
126 return D3DPOOL_DEFAULT
;
130 ICOM_VTABLE(IDirect3DResource8
) Direct3DResource8_Vtbl
=
132 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
133 IDirect3DResource8Impl_QueryInterface
,
134 IDirect3DResource8Impl_AddRef
,
135 IDirect3DResource8Impl_Release
,
136 IDirect3DResource8Impl_GetDevice
,
137 IDirect3DResource8Impl_SetPrivateData
,
138 IDirect3DResource8Impl_GetPrivateData
,
139 IDirect3DResource8Impl_FreePrivateData
,
140 IDirect3DResource8Impl_SetPriority
,
141 IDirect3DResource8Impl_GetPriority
,
142 IDirect3DResource8Impl_PreLoad
,
143 IDirect3DResource8Impl_GetType