1 | /*
|
---|
2 | * IDirect3DBaseTexture9 implementation
|
---|
3 | *
|
---|
4 | * Copyright 2002-2004 Jason Edmeades
|
---|
5 | * Raphael Junqueira
|
---|
6 | *
|
---|
7 | * This library is free software; you can redistribute it and/or
|
---|
8 | * modify it under the terms of the GNU Lesser General Public
|
---|
9 | * License as published by the Free Software Foundation; either
|
---|
10 | * version 2.1 of the License, or (at your option) any later version.
|
---|
11 | *
|
---|
12 | * This library is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
15 | * Lesser General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU Lesser General Public
|
---|
18 | * License along with this library; if not, write to the Free Software
|
---|
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*
|
---|
23 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
24 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
25 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
26 | * a choice of LGPL license versions is made available with the language indicating
|
---|
27 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
28 | * of the LGPL is applied is otherwise unspecified.
|
---|
29 | */
|
---|
30 |
|
---|
31 | #include "config.h"
|
---|
32 | #include "d3d9_private.h"
|
---|
33 |
|
---|
34 | WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
|
---|
35 |
|
---|
36 | /* IDirect3DBaseTexture9 IUnknown parts follow: */
|
---|
37 | static HRESULT WINAPI IDirect3DBaseTexture9Impl_QueryInterface(LPDIRECT3DBASETEXTURE9 iface, REFIID riid, LPVOID* ppobj) {
|
---|
38 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
39 | TRACE("(%p) Relay\n" , This);
|
---|
40 | if (IsEqualGUID(riid, &IID_IUnknown)
|
---|
41 | || IsEqualGUID(riid, &IID_IDirect3DResource9)
|
---|
42 | || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)) {
|
---|
43 | IDirect3DBaseTexture9_AddRef(iface);
|
---|
44 | *ppobj = This;
|
---|
45 | return S_OK;
|
---|
46 | }
|
---|
47 |
|
---|
48 | WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
---|
49 | *ppobj = NULL;
|
---|
50 | return E_NOINTERFACE;
|
---|
51 | }
|
---|
52 |
|
---|
53 | static ULONG WINAPI IDirect3DBaseTexture9Impl_AddRef(LPDIRECT3DBASETEXTURE9 iface) {
|
---|
54 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
55 | ULONG ref = InterlockedIncrement(&This->ref);
|
---|
56 |
|
---|
57 | TRACE("(%p) : AddRef from %d\n", This, ref - 1);
|
---|
58 |
|
---|
59 | return ref;
|
---|
60 | }
|
---|
61 |
|
---|
62 | static ULONG WINAPI IDirect3DBaseTexture9Impl_Release(LPDIRECT3DBASETEXTURE9 iface) {
|
---|
63 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
64 | ULONG ref = InterlockedDecrement(&This->ref);
|
---|
65 |
|
---|
66 | TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
---|
67 |
|
---|
68 | if (ref == 0) {
|
---|
69 | IWineD3DBaseTexture_Release(This->wineD3DBaseTexture);
|
---|
70 | HeapFree(GetProcessHeap(), 0, This);
|
---|
71 | }
|
---|
72 | return ref;
|
---|
73 | }
|
---|
74 |
|
---|
75 | /* IDirect3DBaseTexture9 IDirect3DResource9 Interface follow: */
|
---|
76 | static HRESULT WINAPI IDirect3DBaseTexture9Impl_GetDevice(LPDIRECT3DBASETEXTURE9 iface, IDirect3DDevice9** ppDevice) {
|
---|
77 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
78 | TRACE("(%p) Relay\n" , This);
|
---|
79 | return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
|
---|
80 | }
|
---|
81 |
|
---|
82 | static HRESULT WINAPI IDirect3DBaseTexture9Impl_SetPrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
---|
83 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
84 | TRACE("(%p) Relay\n" , This);
|
---|
85 | return IWineD3DBaseTexture_SetPrivateData(This->wineD3DBaseTexture, refguid, pData, SizeOfData, Flags);
|
---|
86 | }
|
---|
87 |
|
---|
88 | static HRESULT WINAPI IDirect3DBaseTexture9Impl_GetPrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
---|
89 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
90 | TRACE("(%p) Relay\n" , This);
|
---|
91 | return IWineD3DBaseTexture_GetPrivateData(This->wineD3DBaseTexture, refguid, pData, pSizeOfData);
|
---|
92 | }
|
---|
93 |
|
---|
94 | static HRESULT WINAPI IDirect3DBaseTexture9Impl_FreePrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid) {
|
---|
95 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
96 | TRACE("(%p) Relay\n" , This);
|
---|
97 | return IWineD3DBaseTexture_FreePrivateData(This->wineD3DBaseTexture, refguid);
|
---|
98 | }
|
---|
99 |
|
---|
100 | static DWORD WINAPI IDirect3DBaseTexture9Impl_SetPriority(LPDIRECT3DBASETEXTURE9 iface, DWORD PriorityNew) {
|
---|
101 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
102 | TRACE("(%p) Relay\n" , This);
|
---|
103 | return IWineD3DBaseTexture_SetPriority(This->wineD3DBaseTexture, PriorityNew);
|
---|
104 | }
|
---|
105 |
|
---|
106 | static DWORD WINAPI IDirect3DBaseTexture9Impl_GetPriority(LPDIRECT3DBASETEXTURE9 iface) {
|
---|
107 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
108 | TRACE("(%p) Relay\n" , This);
|
---|
109 | return IWineD3DBaseTexture_GetPriority(This->wineD3DBaseTexture);
|
---|
110 | }
|
---|
111 |
|
---|
112 | static void WINAPI IDirect3DBaseTexture9Impl_PreLoad(LPDIRECT3DBASETEXTURE9 iface) {
|
---|
113 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
114 | TRACE("(%p) Relay\n" , This);
|
---|
115 | IWineD3DBaseTexture_PreLoad(This->wineD3DBaseTexture);
|
---|
116 | return ;
|
---|
117 | }
|
---|
118 |
|
---|
119 | static D3DRESOURCETYPE WINAPI IDirect3DBaseTexture9Impl_GetType(LPDIRECT3DBASETEXTURE9 iface) {
|
---|
120 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
121 | TRACE("(%p) Relay\n" , This);
|
---|
122 | return IWineD3DBaseTexture_GetType(This->wineD3DBaseTexture);
|
---|
123 | }
|
---|
124 |
|
---|
125 | /* IDirect3DBaseTexture9 Interface follow: */
|
---|
126 | static DWORD WINAPI IDirect3DBaseTexture9Impl_SetLOD(LPDIRECT3DBASETEXTURE9 iface, DWORD LODNew) {
|
---|
127 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
128 | TRACE("(%p) Relay\n" , This);
|
---|
129 | return IWineD3DBaseTexture_SetLOD(This->wineD3DBaseTexture, LODNew);
|
---|
130 | }
|
---|
131 |
|
---|
132 | DWORD WINAPI IDirect3DBaseTexture9Impl_GetLOD(LPDIRECT3DBASETEXTURE9 iface) {
|
---|
133 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
134 | TRACE("(%p) Relay\n" , This);
|
---|
135 | return IWineD3DBaseTexture_GetLOD(This->wineD3DBaseTexture);
|
---|
136 | }
|
---|
137 |
|
---|
138 | static DWORD WINAPI IDirect3DBaseTexture9Impl_GetLevelCount(LPDIRECT3DBASETEXTURE9 iface) {
|
---|
139 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
140 | TRACE("(%p) Relay\n" , This);
|
---|
141 | return IWineD3DBaseTexture_GetLevelCount(This->wineD3DBaseTexture);
|
---|
142 | }
|
---|
143 |
|
---|
144 | static HRESULT WINAPI IDirect3DBaseTexture9Impl_SetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) {
|
---|
145 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
146 | TRACE("(%p) Relay\n" , This);
|
---|
147 | return IWineD3DBaseTexture_SetAutoGenFilterType(This->wineD3DBaseTexture, (WINED3DTEXTUREFILTERTYPE) FilterType);
|
---|
148 | }
|
---|
149 |
|
---|
150 | static D3DTEXTUREFILTERTYPE WINAPI IDirect3DBaseTexture9Impl_GetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface) {
|
---|
151 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
152 | TRACE("(%p) Relay\n" , This);
|
---|
153 | return (D3DTEXTUREFILTERTYPE) IWineD3DBaseTexture_GetAutoGenFilterType(This->wineD3DBaseTexture);
|
---|
154 | }
|
---|
155 |
|
---|
156 | static void WINAPI IDirect3DBaseTexture9Impl_GenerateMipSubLevels(LPDIRECT3DBASETEXTURE9 iface) {
|
---|
157 | IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface;
|
---|
158 | TRACE("(%p) Relay\n" , This);
|
---|
159 | IWineD3DBaseTexture_GenerateMipSubLevels(This->wineD3DBaseTexture);
|
---|
160 | }
|
---|
161 |
|
---|
162 | const IDirect3DBaseTexture9Vtbl Direct3DBaseTexture9_Vtbl =
|
---|
163 | {
|
---|
164 | IDirect3DBaseTexture9Impl_QueryInterface,
|
---|
165 | IDirect3DBaseTexture9Impl_AddRef,
|
---|
166 | IDirect3DBaseTexture9Impl_Release,
|
---|
167 | IDirect3DBaseTexture9Impl_GetDevice,
|
---|
168 | IDirect3DBaseTexture9Impl_SetPrivateData,
|
---|
169 | IDirect3DBaseTexture9Impl_GetPrivateData,
|
---|
170 | IDirect3DBaseTexture9Impl_FreePrivateData,
|
---|
171 | IDirect3DBaseTexture9Impl_SetPriority,
|
---|
172 | IDirect3DBaseTexture9Impl_GetPriority,
|
---|
173 | IDirect3DBaseTexture9Impl_PreLoad,
|
---|
174 | IDirect3DBaseTexture9Impl_GetType,
|
---|
175 | IDirect3DBaseTexture9Impl_SetLOD,
|
---|
176 | IDirect3DBaseTexture9Impl_GetLOD,
|
---|
177 | IDirect3DBaseTexture9Impl_GetLevelCount,
|
---|
178 | IDirect3DBaseTexture9Impl_SetAutoGenFilterType,
|
---|
179 | IDirect3DBaseTexture9Impl_GetAutoGenFilterType,
|
---|
180 | IDirect3DBaseTexture9Impl_GenerateMipSubLevels
|
---|
181 | };
|
---|