Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

535 lines
18 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: texture.c
  6. * Content: Direct3DTexture interface
  7. *@@BEGIN_MSINTERNAL
  8. *
  9. * $Id$
  10. *
  11. * History:
  12. * Date By Reason
  13. * ==== == ======
  14. * 07/12/95 stevela Merged Colin's changes.
  15. * 10/12/95 stevela Removed AGGREGATE_D3D
  16. * 17/04/96 colinmc Bug 12185: Debug output too aggresive
  17. * 30/04/96 stevela Bug 18898: Wrong error returned on invalid GetHandle
  18. *@@END_MSINTERNAL
  19. *
  20. ***************************************************************************/
  21. #include "pch.cpp"
  22. #pragma hdrstop
  23. /*
  24. * Create an api for the Direct3DTexture object
  25. */
  26. #undef DPF_MODNAME
  27. #define DPF_MODNAME "Direct3DTexture"
  28. void D3DI_RemoveTextureHandle(LPD3DI_TEXTUREBLOCK lpBlock)
  29. {
  30. /* check if this block refers to a Texture/Texture2 - this
  31. * needs to handle both texture types for device cleanup
  32. */
  33. if (lpBlock->hTex)
  34. {
  35. D3DHAL_TextureDestroy(lpBlock);
  36. }
  37. }
  38. DIRECT3DTEXTUREI::DIRECT3DTEXTUREI()
  39. {
  40. m_dwHeapIndex = 0;
  41. m_bInUse = FALSE;
  42. m_dwPriority = 0;
  43. m_dwLOD = 0;
  44. bDirty = FALSE;
  45. }
  46. //---------------------------------------------------------------------
  47. #undef DPF_MODNAME
  48. #define DPF_MODNAME "DIRECT3DTEXTUREI::Initialize"
  49. HRESULT DIRECT3DTEXTUREI::Initialize(LPDIRECT3DI lpDirect3DI, LPDIRECTDRAWSURFACE7 pDDS)
  50. {
  51. LIST_INITIALIZE(&blocks);
  52. this->DDS1Tex.lpVtbl = ((LPDDRAWI_DIRECTDRAW_INT)(lpDirect3DI->lpDD7))->lpLcl->pddSurfaceCallbacks;
  53. this->DDS1Tex.lpLcl = ((LPDDRAWI_DDRAWSURFACE_INT)pDDS)->lpLcl;
  54. this->DDS1Tex.lpLink = NULL;
  55. this->DDS1Tex.dwIntRefCnt = 1;
  56. this->lpDDS = pDDS;
  57. this->lpDDSSys = NULL;
  58. this->m_hTex = ((LPDDRAWI_DDRAWSURFACE_INT)pDDS)->lpLcl->lpSurfMore->dwSurfaceHandle;
  59. this->lpDirect3DI = lpDirect3DI;
  60. this->lpDirect3DI->AddRef(); // Since we hold a pointer to D3DI
  61. // Hook texture into the list
  62. LIST_INSERT_ROOT(&this->lpDirect3DI->textures, this, m_List);
  63. return D3D_OK;
  64. }
  65. //---------------------------------------------------------------------
  66. #undef DPF_MODNAME
  67. #define DPF_MODNAME "DIRECT3DTEXTUREI::Destroy"
  68. void DIRECT3DTEXTUREI::Destroy()
  69. {
  70. // lpDDS or lpDDSSys need to remain alive during the while loop
  71. while (LIST_FIRST(&this->blocks))
  72. {
  73. LPD3DI_TEXTUREBLOCK tBlock = LIST_FIRST(&this->blocks);
  74. D3DI_RemoveTextureHandle(tBlock);
  75. // Remove from device
  76. LIST_DELETE(tBlock, devList);
  77. // Remove from texture
  78. LIST_DELETE(tBlock, list);
  79. D3DFree(tBlock);
  80. }
  81. LIST_DELETE(this, m_List); // Remove ourself from the texture chain
  82. lpDirect3DI->Release(); // Remove the Addref from Create
  83. }
  84. //---------------------------------------------------------------------
  85. #undef DPF_MODNAME
  86. #define DPF_MODNAME "DIRECT3DTEXTURED3DM::Initialize"
  87. HRESULT DIRECT3DTEXTURED3DM::Initialize(LPDIRECT3DI lpDirect3DI, LPDIRECTDRAWSURFACE7 pDDS)
  88. {
  89. HRESULT ddrval = DIRECT3DTEXTUREI::Initialize(lpDirect3DI, pDDS);
  90. if(ddrval != D3D_OK)
  91. return ddrval;
  92. memset(&this->ddsd, 0, sizeof(DDSURFACEDESC2));
  93. this->ddsd.dwSize = sizeof(DDSURFACEDESC2);
  94. ddrval = pDDS->GetSurfaceDesc(&this->ddsd);
  95. if(ddrval != DD_OK)
  96. {
  97. D3D_ERR("Failed to get surface descriptor for texture");
  98. return ddrval;
  99. }
  100. this->ddsd.dwFlags &= ~DDSD_PITCH; // DDRAW always give that, but we don't want
  101. if(this->ddsd.ddsCaps.dwCaps & DDSCAPS_NONLOCALVIDMEM)
  102. {
  103. this->ddsd.ddsCaps.dwCaps &= ~DDSCAPS_NONLOCALVIDMEM;
  104. this->ddsd.ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM;
  105. }
  106. else
  107. {
  108. this->ddsd.ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY;
  109. this->ddsd.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
  110. }
  111. this->ddsd.ddsCaps.dwCaps2 &= ~(DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE);
  112. this->ddsd.ddsCaps.dwCaps2 |= DDSCAPS2_DONOTCREATED3DTEXOBJECT;
  113. if(((LPDDRAWI_DIRECTDRAW_INT)(lpDirect3DI->lpDD7))->lpLcl->lpGbl->lpD3DGlobalDriverData)
  114. {
  115. if(!(((LPDDRAWI_DIRECTDRAW_INT)(lpDirect3DI->lpDD7))->lpLcl->lpGbl->lpD3DGlobalDriverData->hwCaps.dwDevCaps & D3DDEVCAPS_SEPARATETEXTUREMEMORIES) ||
  116. !(this->ddsd.dwFlags & DDSD_TEXTURESTAGE) ||
  117. (((LPDDRAWI_DIRECTDRAW_INT)(lpDirect3DI->lpDD7))->lpLcl->lpGbl->lpD3DExtendedCaps->wMaxSimultaneousTextures < 2))
  118. this->ddsd.dwTextureStage = 0;
  119. }
  120. else
  121. {
  122. this->ddsd.dwTextureStage = 0;
  123. }
  124. this->lpDDSSys = pDDS;
  125. this->lpDDS = NULL;
  126. this->m_hTex = 0;
  127. this->m_dwBytes = 0;
  128. this->m_dwVidBytes = 0;
  129. // Next, we need to loop thru and set pointers to the dirty
  130. // bit in the DDraw surfaces
  131. for(CCubemapIter cmit(((LPDDRAWI_DDRAWSURFACE_INT)this->lpDDSSys)->lpLcl); cmit != 0; ++cmit)
  132. {
  133. // Set the faces bit so that when the cubemap is eventually created in vidmem, it will get all faces
  134. this->ddsd.ddsCaps.dwCaps2 |= (cmit()->lpSurfMore->ddsCapsEx.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES);
  135. for(CMipmapIter mmit(cmit()); mmit != 0; ++mmit)
  136. {
  137. mmit()->lpSurfMore->lpbDirty = &(this->bDirty);
  138. if(this->ddsd.dwFlags & DDSD_LINEARSIZE)
  139. m_dwBytes += mmit()->lpGbl->dwLinearSize;
  140. else
  141. m_dwBytes += mmit()->lpGbl->lPitch * mmit()->lpGbl->wHeight;
  142. }
  143. }
  144. #if COLLECTSTATS
  145. this->lpDirect3DI->lpTextureManager->IncTotSz(m_dwBytes);
  146. #endif
  147. return D3D_OK;
  148. }
  149. //---------------------------------------------------------------------
  150. #undef DPF_MODNAME
  151. #define DPF_MODNAME "DIRECT3DTEXTURED3DM::Destroy"
  152. void DIRECT3DTEXTURED3DM::Destroy()
  153. {
  154. DIRECT3DTEXTUREI::Destroy();
  155. if(InVidmem())
  156. {
  157. this->lpDirect3DI->lpTextureManager->RemoveFromHeap(this);
  158. this->lpDirect3DI->lpTextureManager->remove(this);
  159. }
  160. #if COLLECTSTATS
  161. this->lpDirect3DI->lpTextureManager->DecTotSz(m_dwBytes);
  162. #endif
  163. }
  164. //---------------------------------------------------------------------
  165. #undef DPF_MODNAME
  166. #define DPF_MODNAME "DIRECT3DTEXTUREI::SetPriority"
  167. HRESULT DIRECT3DTEXTUREI::SetPriority(DWORD dwPriority)
  168. {
  169. D3D_ERR( "SetPriority called on unmanaged texture." );
  170. return DDERR_INVALIDPARAMS;
  171. }
  172. //---------------------------------------------------------------------
  173. #undef DPF_MODNAME
  174. #define DPF_MODNAME "DIRECT3DTEXTUREI::GetPriority"
  175. HRESULT DIRECT3DTEXTUREI::GetPriority(LPDWORD lpdwPriority)
  176. {
  177. D3D_ERR( "GetPriority called on unmanaged texture." );
  178. return DDERR_INVALIDPARAMS;
  179. }
  180. //---------------------------------------------------------------------
  181. #undef DPF_MODNAME
  182. #define DPF_MODNAME "DIRECT3DTEXTUREI::SetLOD"
  183. HRESULT DIRECT3DTEXTUREI::SetLOD(DWORD dwLOD)
  184. {
  185. D3D_ERR( "SetLOD called on unmanaged texture." );
  186. return DDERR_INVALIDPARAMS;
  187. }
  188. //---------------------------------------------------------------------
  189. #undef DPF_MODNAME
  190. #define DPF_MODNAME "DIRECT3DTEXTUREI::GetLOD"
  191. HRESULT DIRECT3DTEXTUREI::GetLOD(LPDWORD lpdwLOD)
  192. {
  193. D3D_ERR( "GetLOD called on unmanaged texture." );
  194. return DDERR_INVALIDPARAMS;
  195. }
  196. //---------------------------------------------------------------------
  197. #undef DPF_MODNAME
  198. #define DPF_MODNAME "DIRECT3DTEXTUREM::SetPriority"
  199. HRESULT DIRECT3DTEXTUREM::SetPriority(DWORD dwPriority)
  200. {
  201. try
  202. {
  203. m_dwPriority = dwPriority;
  204. // Look for a hardware device
  205. LPDIRECT3DDEVICEI lpDevI = LIST_FIRST(&this->lpDirect3DI->devices);
  206. if(lpDevI == NULL)
  207. {
  208. D3D_WARN(0, "SetPriority called before D3D device was created.");
  209. }
  210. while (lpDevI)
  211. {
  212. if (lpDevI->dwFEFlags & D3DFE_REALHAL)
  213. {
  214. if(this->lpDirect3DI->numDevs > 1)
  215. {
  216. D3D_WARN(2, "Multiple devices used. Calling Flush");
  217. HRESULT hr = this->lpDirect3DI->FlushDevicesExcept(lpDevI); // to avoid sync problems
  218. if(hr != D3D_OK)
  219. {
  220. DPF_ERR("Error flushing devices in SetPriority");
  221. return hr;
  222. }
  223. }
  224. DDASSERT(IS_DX7HAL_DEVICE(lpDevI));
  225. HRESULT hr = static_cast<CDirect3DDevice7*>(lpDevI)->SetPriorityI(((LPDDRAWI_DDRAWSURFACE_INT)(this->lpDDS))->lpLcl, m_dwPriority);
  226. if(hr != D3D_OK)
  227. {
  228. DPF_ERR("Error inserting SetPriority instruction in batch");
  229. return hr;
  230. }
  231. if(this->lpDirect3DI->numDevs > 1)
  232. {
  233. hr = lpDevI->FlushStates(); // to avoid sync problems
  234. if(hr != D3D_OK)
  235. {
  236. DPF_ERR("Error flushing device in SetPriority");
  237. }
  238. }
  239. else
  240. {
  241. // This will ensure that the SetPriority gets to the driver before
  242. // Blting or Locking the (texture) surface. Not sure that this is
  243. // necessary.
  244. lpDevI->BatchTexture(((LPDDRAWI_DDRAWSURFACE_INT)(this->lpDDS))->lpLcl);
  245. }
  246. return hr;
  247. }
  248. lpDevI = LIST_NEXT(lpDevI,list);
  249. }
  250. return D3D_OK;
  251. }
  252. catch (HRESULT ret)
  253. {
  254. return ret;
  255. }
  256. }
  257. //---------------------------------------------------------------------
  258. #undef DPF_MODNAME
  259. #define DPF_MODNAME "DIRECT3DTEXTUREM::GetPriority"
  260. HRESULT DIRECT3DTEXTUREM::GetPriority(LPDWORD lpdwPriority)
  261. {
  262. *lpdwPriority = m_dwPriority;
  263. return D3D_OK;
  264. }
  265. //---------------------------------------------------------------------
  266. #undef DPF_MODNAME
  267. #define DPF_MODNAME "DIRECT3DTEXTURED3DM::SetPriority"
  268. HRESULT DIRECT3DTEXTURED3DM::SetPriority(DWORD dwPriority)
  269. {
  270. m_dwPriority = dwPriority;
  271. lpDirect3DI->lpTextureManager->UpdatePriority(this);
  272. return D3D_OK;
  273. }
  274. //---------------------------------------------------------------------
  275. #undef DPF_MODNAME
  276. #define DPF_MODNAME "DIRECT3DTEXTUREM::GetLOD"
  277. HRESULT DIRECT3DTEXTUREM::GetLOD(LPDWORD lpdwLOD)
  278. {
  279. *lpdwLOD = m_dwLOD;
  280. return D3D_OK;
  281. }
  282. //---------------------------------------------------------------------
  283. #undef DPF_MODNAME
  284. #define DPF_MODNAME "DIRECT3DTEXTUREM::SetLOD"
  285. HRESULT DIRECT3DTEXTUREM::SetLOD(DWORD dwLOD)
  286. {
  287. try
  288. {
  289. if(dwLOD >= ((LPDDRAWI_DDRAWSURFACE_INT)(this->lpDDS))->lpLcl->lpSurfMore->dwMipMapCount)
  290. {
  291. D3D_ERR( "Texture has insufficient mipmap levels for this LOD" );
  292. return DDERR_INVALIDPARAMS;
  293. }
  294. m_dwLOD = dwLOD;
  295. // Look for a hardware device
  296. LPDIRECT3DDEVICEI lpDevI = LIST_FIRST(&this->lpDirect3DI->devices);
  297. if(lpDevI == NULL)
  298. {
  299. D3D_WARN(0, "SetLOD called before D3D device was created.");
  300. }
  301. while (lpDevI)
  302. {
  303. if (lpDevI->dwFEFlags & D3DFE_REALHAL)
  304. {
  305. if(this->lpDirect3DI->numDevs > 1)
  306. {
  307. D3D_WARN(2, "Multiple devices used. Calling Flush");
  308. HRESULT hr = this->lpDirect3DI->FlushDevicesExcept(lpDevI); // to avoid sync problems
  309. if(hr != D3D_OK)
  310. {
  311. DPF_ERR("Error flushing devices in SetLOD");
  312. return hr;
  313. }
  314. }
  315. DDASSERT(IS_DX7HAL_DEVICE(lpDevI));
  316. HRESULT hr = static_cast<CDirect3DDevice7*>(lpDevI)->SetTexLODI(((LPDDRAWI_DDRAWSURFACE_INT)(this->lpDDS))->lpLcl, m_dwLOD);
  317. if(hr != D3D_OK)
  318. {
  319. DPF_ERR("Error inserting SetTexLODI instruction in batch");
  320. return hr;
  321. }
  322. if(this->lpDirect3DI->numDevs > 1)
  323. {
  324. hr = lpDevI->FlushStates(); // to avoid sync problems
  325. if(hr != D3D_OK)
  326. {
  327. DPF_ERR("Error flushing device in SetLODI");
  328. }
  329. }
  330. else
  331. {
  332. // This will ensure that the SetTexLODI gets to the driver before
  333. // Blting or Locking the (texture) surface. Not sure that this is
  334. // necessary.
  335. lpDevI->BatchTexture(((LPDDRAWI_DDRAWSURFACE_INT)(this->lpDDS))->lpLcl);
  336. }
  337. return hr;
  338. }
  339. lpDevI = LIST_NEXT(lpDevI,list);
  340. }
  341. return D3D_OK;
  342. }
  343. catch (HRESULT ret)
  344. {
  345. return ret;
  346. }
  347. }
  348. //---------------------------------------------------------------------
  349. #undef DPF_MODNAME
  350. #define DPF_MODNAME "DIRECT3DTEXTURED3DM::SetLOD"
  351. HRESULT DIRECT3DTEXTURED3DM::SetLOD(DWORD dwLOD)
  352. {
  353. if(dwLOD >= ((LPDDRAWI_DDRAWSURFACE_INT)(this->lpDDSSys))->lpLcl->lpSurfMore->dwMipMapCount)
  354. {
  355. D3D_ERR( "Texture has insufficient mipmap levels for this LOD" );
  356. return DDERR_INVALIDPARAMS;
  357. }
  358. if(m_dwLOD != dwLOD)
  359. {
  360. m_dwLOD = dwLOD;
  361. this->ddsd.dwWidth = ((LPDDRAWI_DDRAWSURFACE_INT)(this->lpDDSSys))->lpLcl->lpGbl->wWidth >> m_dwLOD;
  362. if(this->ddsd.dwWidth == 0)
  363. this->ddsd.dwWidth = 1;
  364. this->ddsd.dwHeight = ((LPDDRAWI_DDRAWSURFACE_INT)(this->lpDDSSys))->lpLcl->lpGbl->wHeight >> m_dwLOD;
  365. if(this->ddsd.dwHeight == 0)
  366. this->ddsd.dwHeight = 1;
  367. this->ddsd.dwMipMapCount = ((LPDDRAWI_DDRAWSURFACE_INT)(this->lpDDSSys))->lpLcl->lpSurfMore->dwMipMapCount - m_dwLOD;
  368. if(InVidmem())
  369. {
  370. this->lpDirect3DI->lpTextureManager->RemoveFromHeap(this);
  371. this->lpDirect3DI->lpTextureManager->remove(this);
  372. }
  373. D3DTextureUpdate(static_cast<LPUNKNOWN>(&(this->lpDirect3DI->mD3DUnk)));
  374. }
  375. return D3D_OK;
  376. }
  377. //---------------------------------------------------------------------
  378. #undef DPF_MODNAME
  379. #define DPF_MODNAME "DIRECT3DTEXTURED3DM::MarkDirtyPointers"
  380. void DIRECT3DTEXTURED3DM::MarkDirtyPointers()
  381. {
  382. // We need to loop thru and set pointers to the dirty
  383. // bit in the DDraw surfaces. The dirty bit will be
  384. // used to properly update vidmem copies after they
  385. // have been lost and restored.
  386. CCubemapIter cmsysmem(((LPDDRAWI_DDRAWSURFACE_INT)this->lpDDSSys)->lpLcl);
  387. CCubemapIter cmvidmem(((LPDDRAWI_DDRAWSURFACE_INT)this->lpDDS)->lpLcl);
  388. m_dwVidBytes = 0;
  389. do
  390. {
  391. CMipmapIter mmsysmem(cmsysmem()), mmvidmem(cmvidmem());
  392. do
  393. {
  394. mmvidmem()->lpSurfMore->lpbDirty = &(this->bDirty);
  395. mmvidmem()->lpSurfMore->lpRegionList = mmsysmem()->lpSurfMore->lpRegionList;
  396. // Mark everything dirty since we are going to copy into this surface
  397. // from sysmem
  398. mmvidmem()->lpSurfMore->lpRegionList->rdh.nCount = NUM_RECTS_IN_REGIONLIST;
  399. if(this->ddsd.dwFlags & DDSD_LINEARSIZE)
  400. m_dwVidBytes += mmvidmem()->lpGbl->dwLinearSize;
  401. else
  402. m_dwVidBytes += mmvidmem()->lpGbl->lPitch * mmvidmem()->lpGbl->wHeight;
  403. ++mmvidmem;
  404. ++mmsysmem;
  405. }
  406. while(mmsysmem != 0 && mmvidmem != 0);
  407. ++cmvidmem;
  408. ++cmsysmem;
  409. }
  410. while(cmsysmem != 0);
  411. }
  412. //---------------------------------------------------------------------
  413. #undef DPF_MODNAME
  414. #define DPF_MODNAME "CreateTexture"
  415. extern "C" HRESULT WINAPI CreateTexture(LPDIRECTDRAWSURFACE7 pDDS)
  416. {
  417. LPDIRECT3DTEXTUREI pTex;
  418. LPDDRAWI_DDRAWSURFACE_LCL pLcl = ((LPDDRAWI_DDRAWSURFACE_INT)pDDS)->lpLcl;
  419. // Should this texture be managed by D3D?
  420. if(((DDSCAPS2_TEXTUREMANAGE & pLcl->lpSurfMore->ddsCapsEx.dwCaps2) && !(DDCAPS2_CANMANAGETEXTURE & pLcl->lpSurfMore->lpDD_lcl->lpGbl->ddCaps.dwCaps2))
  421. || (DDSCAPS2_D3DTEXTUREMANAGE & pLcl->lpSurfMore->ddsCapsEx.dwCaps2))
  422. {
  423. pTex = static_cast<LPDIRECT3DTEXTUREI>(new DIRECT3DTEXTURED3DM);
  424. }
  425. // Should this texture be managed by the driver?
  426. else if((DDSCAPS2_TEXTUREMANAGE & pLcl->lpSurfMore->ddsCapsEx.dwCaps2) && (DDCAPS2_CANMANAGETEXTURE & pLcl->lpSurfMore->lpDD_lcl->lpGbl->ddCaps.dwCaps2))
  427. {
  428. pTex = static_cast<LPDIRECT3DTEXTUREI>(new DIRECT3DTEXTUREM);
  429. }
  430. // This texture is unmanaged
  431. else
  432. {
  433. pTex = static_cast<LPDIRECT3DTEXTUREI>(new DIRECT3DTEXTUREI);
  434. }
  435. if (!pTex)
  436. {
  437. D3D_ERR("failed to allocate space for texture object");
  438. return (DDERR_OUTOFMEMORY);
  439. }
  440. LPDIRECT3DI lpD3D = static_cast<CDirect3DUnk*>(pLcl->lpSurfMore->lpDD_lcl->pD3DIUnknown)->pD3DI;
  441. DDASSERT(lpD3D);
  442. HRESULT ddrval = pTex->Initialize(lpD3D, pDDS);
  443. if(ddrval != D3D_OK)
  444. {
  445. D3D_ERR("Failed to initialize texture.");
  446. delete pTex;
  447. return ddrval;
  448. }
  449. pLcl->lpSurfMore->lpTex = reinterpret_cast<LPVOID>(pTex);
  450. #if COLLECTSTATS
  451. pTex->lpDirect3DI->IncNumTexCreates();
  452. #endif
  453. return (D3D_OK);
  454. }
  455. #undef DPF_MODNAME
  456. #define DPF_MODNAME "DestroyTexture"
  457. extern "C" void WINAPI DestroyTexture(LPVOID pTex)
  458. {
  459. D3D_INFO(3, "Destroying D3D texture");
  460. LPDIRECT3DTEXTUREI lpTexI = reinterpret_cast<LPDIRECT3DTEXTUREI>(pTex);
  461. #if COLLECTSTATS
  462. lpTexI->lpDirect3DI->IncNumTexDestroys();
  463. #endif
  464. lpTexI->Destroy();
  465. delete lpTexI;
  466. }
  467. #undef DPF_MODNAME
  468. #define DPF_MODNAME "SetPriority"
  469. extern "C" HRESULT WINAPI SetPriority(LPVOID lpTexI, DWORD dwPriority)
  470. {
  471. #if COLLECTSTATS
  472. reinterpret_cast<LPDIRECT3DTEXTUREI>(lpTexI)->lpDirect3DI->IncNumSetPris();
  473. #endif
  474. return reinterpret_cast<LPDIRECT3DTEXTUREI>(lpTexI)->SetPriority(dwPriority);
  475. }
  476. #undef DPF_MODNAME
  477. #define DPF_MODNAME "GetPriority"
  478. extern "C" HRESULT WINAPI GetPriority(LPVOID lpTexI, LPDWORD lpdwPriority)
  479. {
  480. return reinterpret_cast<LPDIRECT3DTEXTUREI>(lpTexI)->GetPriority(lpdwPriority);
  481. }
  482. #undef DPF_MODNAME
  483. #define DPF_MODNAME "SetLOD"
  484. extern "C" HRESULT WINAPI SetLOD(LPVOID lpTexI, DWORD dwLOD)
  485. {
  486. #if COLLECTSTATS
  487. reinterpret_cast<LPDIRECT3DTEXTUREI>(lpTexI)->lpDirect3DI->IncNumSetLODs();
  488. #endif
  489. return reinterpret_cast<LPDIRECT3DTEXTUREI>(lpTexI)->SetLOD(dwLOD);
  490. }
  491. #undef DPF_MODNAME
  492. #define DPF_MODNAME "GetLOD"
  493. extern "C" HRESULT WINAPI GetLOD(LPVOID lpTexI, LPDWORD lpdwLOD)
  494. {
  495. return reinterpret_cast<LPDIRECT3DTEXTUREI>(lpTexI)->GetLOD(lpdwLOD);
  496. }