Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygend3d9_mipmap.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS ReactX 00004 * FILE: dll/directx/d3d9/d3d9_mipmap.c 00005 * PURPOSE: d3d9.dll internal mip map surface functions 00006 * PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com> 00007 */ 00008 #include "d3d9_mipmap.h" 00009 #include "debug.h" 00010 #include "d3d9_texture.h" 00011 #include "d3d9_device.h" 00012 #include "d3d9_helpers.h" 00013 #include <d3d9.h> 00014 00015 #define LOCK_D3DDEVICE9() D3D9BaseObject_LockDevice(&This->BaseTexture.BaseResource.BaseObject) 00016 #define UNLOCK_D3DDEVICE9() D3D9BaseObject_UnlockDevice(&This->BaseTexture.BaseResource.BaseObject) 00017 00018 /* Convert a IDirect3DTexture9 pointer safely to the internal implementation struct */ 00019 LPD3D9MIPMAP IDirect3DTexture9ToImpl(LPDIRECT3DTEXTURE9 iface) 00020 { 00021 if (NULL == iface) 00022 return NULL; 00023 00024 return (LPD3D9MIPMAP)((ULONG_PTR)iface - FIELD_OFFSET(D3D9MipMap, lpVtbl)); 00025 } 00026 00027 /* IUnknown */ 00028 static HRESULT WINAPI D3D9MipMap_QueryInterface(LPDIRECT3DTEXTURE9 iface, REFIID riid, void** ppvObject) 00029 { 00030 LPD3D9MIPMAP This = IDirect3DTexture9ToImpl(iface); 00031 00032 if (IsEqualGUID(riid, &IID_IUnknown) || 00033 IsEqualGUID(riid, &IID_IDirect3DTexture9) || 00034 IsEqualGUID(riid, &IID_IDirect3DBaseTexture9) || 00035 IsEqualGUID(riid, &IID_IDirect3DResource9)) 00036 { 00037 IUnknown_AddRef(iface); 00038 *ppvObject = &This->lpVtbl; 00039 return D3D_OK; 00040 } 00041 00042 *ppvObject = NULL; 00043 return E_NOINTERFACE; 00044 } 00045 00046 ULONG WINAPI D3D9MipMap_AddRef(LPDIRECT3DTEXTURE9 iface) 00047 { 00048 LPD3D9MIPMAP This = IDirect3DTexture9ToImpl(iface); 00049 return D3D9BaseObject_AddRef(&This->BaseTexture.BaseResource.BaseObject); 00050 } 00051 00052 ULONG WINAPI D3D9MipMap_Release(LPDIRECT3DTEXTURE9 iface) 00053 { 00054 LPD3D9MIPMAP This = IDirect3DTexture9ToImpl(iface); 00055 return D3D9BaseObject_Release(&This->BaseTexture.BaseResource.BaseObject); 00056 } 00057 00058 /* IDirect3DResource9 */ 00059 00060 /*++ 00061 * @name IDirect3DTexture9::GetDevice 00062 * @implemented 00063 * 00064 * The function D3D9MipMap_GetDevice sets the ppDevice argument 00065 * to the device connected to create the swap chain. 00066 * 00067 * @param LPDIRECT3DTEXTURE9 iface 00068 * Pointer to a IDirect3DTexture9 object returned from IDirect3D9Device::CreateTexture() 00069 * 00070 * @param IDirect3DDevice9** ppDevice 00071 * Pointer to a IDirect3DDevice9* structure to be set to the device object. 00072 * 00073 * @return HRESULT 00074 * If the method successfully sets the ppDevice value, the return value is D3D_OK. 00075 * If ppDevice is a bad pointer the return value will be D3DERR_INVALIDCALL. 00076 * If the texture didn't contain any device, the return value will be D3DERR_INVALIDDEVICE. 00077 * 00078 */ 00079 HRESULT WINAPI D3D9MipMap_GetDevice(LPDIRECT3DTEXTURE9 iface, IDirect3DDevice9** ppDevice) 00080 { 00081 LPD3D9MIPMAP This = IDirect3DTexture9ToImpl(iface); 00082 LOCK_D3DDEVICE9(); 00083 00084 if (NULL == ppDevice) 00085 { 00086 DPRINT1("Invalid ppDevice parameter specified"); 00087 UNLOCK_D3DDEVICE9(); 00088 return D3DERR_INVALIDCALL; 00089 } 00090 00091 if (FAILED(D3D9BaseObject_GetDevice(&This->BaseTexture.BaseResource.BaseObject, ppDevice))) 00092 { 00093 DPRINT1("Invalid This parameter speficied"); 00094 UNLOCK_D3DDEVICE9(); 00095 return D3DERR_INVALIDDEVICE; 00096 } 00097 00098 UNLOCK_D3DDEVICE9(); 00099 return D3D_OK; 00100 } 00101 00102 HRESULT WINAPI D3D9MipMap_SetPrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) 00103 { 00104 UNIMPLEMENTED 00105 return D3D_OK; 00106 } 00107 00108 HRESULT WINAPI D3D9MipMap_GetPrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) 00109 { 00110 UNIMPLEMENTED 00111 return D3D_OK; 00112 } 00113 00114 HRESULT WINAPI D3D9MipMap_FreePrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid) 00115 { 00116 UNIMPLEMENTED 00117 return D3D_OK; 00118 } 00119 00120 DWORD WINAPI D3D9MipMap_SetPriority(LPDIRECT3DTEXTURE9 iface, DWORD PriorityNew) 00121 { 00122 UNIMPLEMENTED 00123 return 0; 00124 } 00125 00126 DWORD WINAPI D3D9MipMap_GetPriority(LPDIRECT3DTEXTURE9 iface) 00127 { 00128 UNIMPLEMENTED 00129 return 0; 00130 } 00131 00132 void WINAPI D3D9MipMap_PreLoad(LPDIRECT3DTEXTURE9 iface) 00133 { 00134 UNIMPLEMENTED 00135 } 00136 00137 /* IDirect3DBaseTexture9 */ 00138 D3DRESOURCETYPE WINAPI D3D9MipMap_GetType(LPDIRECT3DTEXTURE9 iface) 00139 { 00140 UNIMPLEMENTED 00141 return D3DRTYPE_TEXTURE; 00142 } 00143 00144 DWORD WINAPI D3D9MipMap_SetLOD(LPDIRECT3DTEXTURE9 iface, DWORD LODNew) 00145 { 00146 UNIMPLEMENTED 00147 return 0; 00148 } 00149 00150 /*++ 00151 * @name IDirect3DTexture9::GetLOD 00152 * @implemented 00153 * 00154 * The function D3D9MipMap_GetLOD returns the number 00155 * max LODs for the specified texture, if it's managed. 00156 * 00157 * @param LPDIRECT3DTEXTURE9 iface 00158 * Pointer to a IDirect3DTexture9 object returned from IDirect3D9Device::CreateTexture(). 00159 * 00160 * @return DWORD 00161 * Returns the number of LODs in the specified texture if it's managed. 00162 * 00163 */ 00164 DWORD WINAPI D3D9MipMap_GetLOD(LPDIRECT3DTEXTURE9 iface) 00165 { 00166 LPD3D9MIPMAP This = IDirect3DTexture9ToImpl(iface); 00167 return D3D9Texture_GetLOD( (IDirect3DBaseTexture9*)&This->BaseTexture.lpVtbl ); 00168 } 00169 00170 /*++ 00171 * @name IDirect3DTexture9::GetLevelCount 00172 * @implemented 00173 * 00174 * The function D3D9MipMap_GetLevelCount returns the number of mip map levels 00175 * in the specified texture. 00176 * 00177 * @param LPDIRECT3DTEXTURE9 iface 00178 * Pointer to a IDirect3DTexture9 object returned from IDirect3D9Device::CreateTexture(). 00179 * 00180 * @return DWORD 00181 * Returns the number of levels in the specified texture. 00182 * 00183 */ 00184 DWORD WINAPI D3D9MipMap_GetLevelCount(LPDIRECT3DTEXTURE9 iface) 00185 { 00186 LPD3D9MIPMAP This = IDirect3DTexture9ToImpl(iface); 00187 return D3D9Texture_GetLevelCount( (IDirect3DBaseTexture9*)&This->BaseTexture.lpVtbl ); 00188 } 00189 00190 HRESULT WINAPI D3D9MipMap_SetAutoGenFilterType(LPDIRECT3DTEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) 00191 { 00192 UNIMPLEMENTED 00193 return D3D_OK; 00194 } 00195 00196 /*++ 00197 * @name IDirect3DTexture9::GetAutoGenFilterType 00198 * @implemented 00199 * 00200 * The function D3D9MipMap_GetAutoGenFilterType returns filter type 00201 * that is used when automated mipmaping is set. 00202 * 00203 * @param LPDIRECT3DTEXTURE9 iface 00204 * Pointer to a IDirect3DTexture9 object returned from IDirect3D9Device::CreateTexture(). 00205 * 00206 * @return D3DTEXTUREFILTERTYPE 00207 * Filter type used when automated mipmaping is set for the specified texture. 00208 * 00209 */ 00210 D3DTEXTUREFILTERTYPE WINAPI D3D9MipMap_GetAutoGenFilterType(LPDIRECT3DTEXTURE9 iface) 00211 { 00212 LPD3D9MIPMAP This = IDirect3DTexture9ToImpl(iface); 00213 return D3D9Texture_GetAutoGenFilterType( (IDirect3DBaseTexture9*)&This->BaseTexture.lpVtbl ); 00214 } 00215 00216 void WINAPI D3D9MipMap_GenerateMipSubLevels(LPDIRECT3DTEXTURE9 iface) 00217 { 00218 UNIMPLEMENTED 00219 } 00220 00221 /* IDirect3DTexture9 */ 00222 HRESULT WINAPI D3D9MipMap_GetLevelDesc(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) 00223 { 00224 UNIMPLEMENTED 00225 return D3D_OK; 00226 } 00227 00228 HRESULT WINAPI D3D9MipMap_GetSurfaceLevel(LPDIRECT3DTEXTURE9 iface, UINT Level, IDirect3DSurface9** ppSurfaceLevel) 00229 { 00230 UNIMPLEMENTED 00231 return D3D_OK; 00232 } 00233 00234 HRESULT WINAPI D3D9MipMap_LockRect(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) 00235 { 00236 UNIMPLEMENTED 00237 return D3D_OK; 00238 } 00239 00240 HRESULT WINAPI D3D9MipMap_UnlockRect(LPDIRECT3DTEXTURE9 iface, UINT Level) 00241 { 00242 UNIMPLEMENTED 00243 return D3D_OK; 00244 } 00245 00246 HRESULT WINAPI D3D9MipMap_AddDirtyRect(LPDIRECT3DTEXTURE9 iface, CONST RECT* pDirtyRect) 00247 { 00248 UNIMPLEMENTED 00249 return D3D_OK; 00250 } 00251 00252 #if !defined(__cplusplus) || defined(CINTERFACE) 00253 static IDirect3DTexture9Vtbl D3D9MipMap_Vtbl = 00254 { 00255 /* IUnknown methods */ 00256 D3D9MipMap_QueryInterface, 00257 D3D9MipMap_AddRef, 00258 D3D9MipMap_Release, 00259 00260 /* IDirect3DBaseTexture9 methods */ 00261 D3D9MipMap_GetDevice, 00262 D3D9MipMap_SetPrivateData, 00263 D3D9MipMap_GetPrivateData, 00264 D3D9MipMap_FreePrivateData, 00265 D3D9MipMap_SetPriority, 00266 D3D9MipMap_GetPriority, 00267 D3D9MipMap_PreLoad, 00268 00269 /* IDirect3DBaseTexture9 methods */ 00270 D3D9MipMap_GetType, 00271 D3D9MipMap_SetLOD, 00272 D3D9MipMap_GetLOD, 00273 D3D9MipMap_GetLevelCount, 00274 D3D9MipMap_SetAutoGenFilterType, 00275 D3D9MipMap_GetAutoGenFilterType, 00276 D3D9MipMap_GenerateMipSubLevels, 00277 00278 /* IDirect3DTexture9 methods */ 00279 D3D9MipMap_GetLevelDesc, 00280 D3D9MipMap_GetSurfaceLevel, 00281 D3D9MipMap_LockRect, 00282 D3D9MipMap_UnlockRect, 00283 D3D9MipMap_AddDirtyRect, 00284 }; 00285 #endif // !defined(__cplusplus) || defined(CINTERFACE) 00286 00287 HRESULT CreateD3D9MipMap(DIRECT3DDEVICE9_INT* pDevice, UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture) 00288 { 00289 LPD3D9MIPMAP pThisTexture; 00290 if (FAILED(AlignedAlloc((LPVOID*)&pThisTexture, sizeof(D3D9MipMap)))) 00291 { 00292 DPRINT1("Could not create D3D9MipMap"); 00293 return E_OUTOFMEMORY; 00294 } 00295 00296 InitDirect3DBaseTexture9(&pThisTexture->BaseTexture, (IDirect3DBaseTexture9Vtbl*)&D3D9MipMap_Vtbl, Usage, Levels, Format, Pool, pDevice, RT_EXTERNAL); 00297 00298 pThisTexture->lpVtbl = &D3D9MipMap_Vtbl; 00299 00300 pThisTexture->Usage = Usage; 00301 pThisTexture->dwWidth = Width; 00302 pThisTexture->dwHeight = Height; 00303 pThisTexture->Format = Format; 00304 00305 *ppTexture = (IDirect3DTexture9*)&pThisTexture->lpVtbl; 00306 00307 UNIMPLEMENTED; 00308 return D3D_OK; 00309 } Generated on Sun May 27 2012 04:21:14 for ReactOS by
1.7.6.1
|