#include <Windows.h>#include <DDraw.h>#include <D3D.H>#include "BaseType.h"#include "DDMemMgr.h"Go to the source code of this file.
|
|
Definition at line 32 of file WireFrame/D3dcache.h. |
|
|
Definition at line 34 of file WireFrame/D3dcache.h. |
|
|
Definition at line 36 of file WireFrame/D3dcache.h. |
|
|
Definition at line 35 of file WireFrame/D3dcache.h. |
|
||||||||||||||||
|
Definition at line 457 of file D3D7xDrv/D3dcache.cpp. References AppendHack, D3DCache_Slot::CacheType, D3DCache::CacheTypes, D3DCache_FreeAllSlots(), D3DCache_IsValid(), D3DCACHE_MAX_CACHE_TYPES, D3DCache_SetupSlot(), D3DCache_WriteToFile(), D3DMain_Log(), DDMemMgr_PartitionAllocMem(), DDMemMgr_PartitionReset(), D3DCache_Type::ddsd, GE_FALSE, GE_TRUE, geBoolean, D3DCache_Type::Height, int32, D3DCache_Type::Log, NULL, D3DCache_Type::NumUsedSlots, D3DCache::Partition, D3DCache_Type::RefCount, D3DCache_Slot::SelfCheck, D3DCache_Type::Slots, D3DCache_Type::Stage, uint32, D3DCache::UseStages, and D3DCache_Type::Width. Referenced by THandle_CheckCache().
00458 {
00459 D3DCache_Type *pCacheType;
00460 int32 i, Total, NumPasses;
00461
00462 assert(D3DCache_IsValid(Cache));
00463
00464 D3DCache_FreeAllSlots(Cache); // Just get rid of everything for now...
00465 DDMemMgr_PartitionReset(Cache->Partition); // Reset the caches memory manager
00466
00467 Total = 0;
00468 NumPasses = 0;
00469
00470 while(1)
00471 {
00472 D3DCache_Slot *LastSlot;
00473
00474 LastSlot = NULL;
00475
00476 pCacheType = Cache->CacheTypes;
00477
00478 for (i=0; i< D3DCACHE_MAX_CACHE_TYPES; i++, pCacheType++)
00479 {
00480 D3DCache_Slot *pSlot;
00481 uint32 Size, Width, Height, Result;
00482
00483 if (pCacheType->RefCount <= 0)
00484 {
00485 assert(pCacheType->Slots == NULL);
00486 continue;
00487 }
00488
00489 if (pCacheType->NumUsedSlots >= pCacheType->RefCount)
00490 continue; // This is all we need for this slot...
00491
00492 if (pCacheType->NumUsedSlots >= MaxTable[pCacheType->Log])
00493 continue;
00494
00495 if (!pCacheType->Slots) // If no slots have been allocated, allocate them now...
00496 {
00497 pCacheType->Slots = (D3DCache_Slot*)malloc(sizeof(D3DCache_Type)*pCacheType->RefCount);
00498 memset(pCacheType->Slots, 0, sizeof(D3DCache_Type)*pCacheType->RefCount);
00499 }
00500
00501 Width = pCacheType->Width;
00502 Height = pCacheType->Height;
00503
00504 Size = Width*Height*(pCacheType->ddsd.ddpfPixelFormat.dwRGBBitCount>>3); // (BitCount/8)
00505
00506 if (UsePartition)
00507 {
00508 if (!DDMemMgr_PartitionAllocMem(Cache->Partition, Size))
00509 {
00510 LastSlot = NULL; // Make a complete stop
00511 break; // No more memory in the partition, stop now...
00512 }
00513 }
00514
00515 pSlot = &pCacheType->Slots[pCacheType->NumUsedSlots];
00516 pSlot->SelfCheck = pSlot;
00517
00518 pSlot->CacheType = pCacheType;
00519
00520 // Allocate surfaces now
00521 Result = D3DCache_SetupSlot(Cache, pSlot, Width, Height, &pCacheType->ddsd, Cache->UseStages, pCacheType->Stage);
00522
00523 if (!Result)
00524 {
00525 memset(pSlot, 0, sizeof(D3DCache_Slot));
00526 break;
00527 }
00528 else if (Result == -1)
00529 {
00530 D3DMain_Log("D3DCache_AdjustSlots: D3DCache_SetupSlot failed.\n");
00531 return GE_FALSE;
00532 }
00533
00534 pCacheType->NumUsedSlots++;
00535 Total++;
00536
00537 LastSlot = pSlot;
00538 }
00539
00540 NumPasses++;
00541
00542 if (!LastSlot) // Nothing was allocated on that pass, so assume we are out of memory
00543 break;
00544 }
00545
00546 pCacheType = Cache->CacheTypes;
00547
00548 // Go through one last time, and make sure all got allocated
00549 for (i=0; i< D3DCACHE_MAX_CACHE_TYPES; i++, pCacheType++)
00550 {
00551 if (pCacheType->RefCount <= 0)
00552 {
00553 assert(pCacheType->Slots == NULL);
00554 continue;
00555 }
00556
00557 if (pCacheType->NumUsedSlots <= 0)
00558 {
00559 D3DMain_Log("D3DCache_AdjustSlots: Out of ram creating surfaces for cache.\n");
00560 D3DMain_Log("D3DCache_AdjustSlots: Pick a display mode with a smaller resolution.\n");
00561 return GE_FALSE; // Not all slots with refs got a texture
00562 }
00563
00564 assert(pCacheType->Slots != NULL);
00565 }
00566
00567 D3DCache_WriteToFile(Cache, "D3DCache.Log", AppendHack);
00568 AppendHack = GE_TRUE;
00569
00570 return GE_TRUE;
00571 }
|
|
||||||||||||||||||||
|
Definition at line 97 of file D3D8Drv/D3dcache.cpp. References D3DCACHE_MAX_NAME, lpDD, D3DCache::lpDD, D3DCache::Name, NULL, Partition, D3DCache::Partition, D3DCache::SelfCheck, and D3DCache::UseStages. Referenced by THandle_Startup().
00098 {
00099 D3DCache *Cache;
00100
00101 Cache = (D3DCache*)malloc(sizeof(D3DCache));
00102
00103 if (!Cache)
00104 return NULL;
00105
00106 memset(Cache, 0, sizeof(D3DCache));
00107
00108 Cache->lpDD = lpDD;
00109
00110 Cache->Partition = Partition;
00111
00112 Cache->UseStages = UseStages;
00113
00114 Cache->SelfCheck = Cache;
00115
00116 strcpy(Cache->Name, Name);
00117
00118 return Cache;
00119 }
|
|
|
Definition at line 138 of file D3D7xDrv/D3dcache.cpp. References D3DCache_FreeAllSlots(). Referenced by FreeAllCaches().
00139 {
00140 assert(Cache);
00141
00142 D3DCache_FreeAllSlots(Cache);
00143
00144 free(Cache);
00145 }
|
|
|
Definition at line 163 of file D3D7xDrv/D3dcache.cpp. References D3DCache::CacheTypes, D3DCache_IsValid(), D3DCACHE_MAX_CACHE_TYPES, D3DCache_SlotSetUserData(), D3DCache_TypeIsValid(), GE_TRUE, geBoolean, int32, NULL, D3DCache_Type::NumUsedSlots, D3DCache_Type::RefCount, s, and D3DCache_Type::Slots. Referenced by D3DMain_RestoreAllSurfaces().
00164 {
00165 int32 i;
00166 D3DCache_Type *pCacheType;
00167
00168 assert(D3DCache_IsValid(Cache));
00169
00170 for (pCacheType = Cache->CacheTypes, i=0; i< D3DCACHE_MAX_CACHE_TYPES; i++, pCacheType++)
00171 {
00172 D3DCache_Slot *pSlot;
00173 int32 s;
00174
00175 if (!pCacheType->RefCount)
00176 continue;
00177
00178 assert(D3DCache_TypeIsValid(pCacheType));
00179
00180 for (pSlot = pCacheType->Slots, s=0; s<pCacheType->NumUsedSlots; s++, pSlot++)
00181 {
00182 D3DCache_SlotSetUserData(pSlot, NULL);
00183 }
00184 }
00185
00186 return GE_TRUE;
00187 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 191 of file D3D7xDrv/D3dcache.cpp. References D3DCache::CacheTypes, D3DCache_IsValid(), D3DCACHE_MAX_CACHE_TYPES, D3DCache_TypeIsValid(), D3DCache_Type::ddsd, D3DCache_Type::Height, int32, NULL, D3DCache_Type::NumMipLevels, D3DCache_Type::RefCount, D3DCache_Type::Stage, and D3DCache_Type::Width. Referenced by D3DCache_TypeCreate().
00192 {
00193 int32 i;
00194 D3DCache_Type *pCacheType;
00195
00196 assert(D3DCache_IsValid(Cache));
00197
00198 pCacheType = Cache->CacheTypes;
00199
00200 for (i=0; i<D3DCACHE_MAX_CACHE_TYPES; i++, pCacheType++)
00201 {
00202 if (pCacheType->RefCount == 0) // Nobody is using this slot yet
00203 continue;
00204
00205 assert(D3DCache_TypeIsValid(pCacheType));
00206
00207 if (pCacheType->Width != Width)
00208 continue;
00209 if (pCacheType->Height != Height)
00210 continue;
00211
00212 if (pCacheType->NumMipLevels != NumMipLevels)
00213 continue;
00214
00215 if (pCacheType->Stage != Stage)
00216 continue;
00217
00218 if (memcmp(&pCacheType->ddsd, ddsd, sizeof(DDSURFACEDESC2)))
00219 continue;
00220
00221 return pCacheType; // Found a match
00222 }
00223
00224 return NULL; // Cache Type not found!!!
00225 }
|
|
|
Definition at line 347 of file D3D7xDrv/D3dcache.cpp. References D3DCache::CacheTypes, D3DCache_IsValid(), D3DCACHE_MAX_CACHE_TYPES, D3DCache_SlotIsValid(), D3DCache_TypeIsValid(), DDMemMgr_PartitionReset(), GE_TRUE, geBoolean, int32, NULL, D3DCache_Type::NumUsedSlots, D3DCache::Partition, D3DCache_Type::RefCount, D3DCache_Type::Slots, D3DCache_Slot::Surface, and D3DCache_Slot::Texture. Referenced by D3DCache_AdjustSlots(), and D3DCache_Destroy().
00348 {
00349 int32 i;
00350 D3DCache_Type *pCacheType;
00351
00352 assert(D3DCache_IsValid(Cache));
00353
00354 pCacheType = Cache->CacheTypes;
00355
00356 for (i=0; i< D3DCACHE_MAX_CACHE_TYPES; i++, pCacheType++)
00357 {
00358 D3DCache_Slot *pSlot;
00359 int32 k;
00360
00361 assert(pCacheType->RefCount >= 0);
00362
00363 if (pCacheType->RefCount == 0)
00364 {
00365 assert(pCacheType->Slots == NULL);
00366 continue;
00367 }
00368
00369 assert(D3DCache_TypeIsValid(pCacheType));
00370
00371 // Go through each slot, and free all the surfaces on them
00372 for (pSlot = pCacheType->Slots, k=0; k< pCacheType->NumUsedSlots; k++, pSlot++)
00373 {
00374 assert(D3DCache_SlotIsValid(pSlot));
00375 assert(pSlot->Surface);
00376 assert(pSlot->Texture);
00377
00378 /* 02/25/2001 Wendell Buckner
00379 /* This texture pointer is no longer valid under directx 7. Set it to TRUE so there is
00380 /* something there when the code does assert checks.
00381 if (pSlot->Texture)
00382 pSlot->Texture->Release();*/
00383 if (pSlot->Surface)
00384 pSlot->Surface->Release();
00385 }
00386
00387 if (pCacheType->Slots)
00388 free(pCacheType->Slots);
00389
00390 pCacheType->Slots = NULL;
00391 pCacheType->NumUsedSlots = 0;
00392 }
00393
00394 DDMemMgr_PartitionReset(Cache->Partition); // Reset the caches memory manager
00395
00396 return GE_TRUE;
00397 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 229 of file D3D7xDrv/D3dcache.cpp. References D3DCache_Type::Cache, D3DCache::CacheTypes, D3DCache_IsValid(), D3DCACHE_MAX_CACHE_TYPES, D3DCache_Type::ddsd, GetLog(), D3DCache_Type::Height, int32, D3DCache_Type::Log, NULL, D3DCache_Type::NumMipLevels, D3DCache_Type::NumUsedSlots, D3DCache_Type::RefCount, D3DCache_Type::SelfCheck, D3DCache_Type::Slots, D3DCache_Type::Stage, and D3DCache_Type::Width. Referenced by D3DCache_TypeCreate().
00230 {
00231 int32 i;
00232 D3DCache_Type *pCacheType;
00233
00234 assert(D3DCache_IsValid(Cache));
00235
00236 pCacheType = Cache->CacheTypes;
00237
00238 for (i=0; i<D3DCACHE_MAX_CACHE_TYPES; i++, pCacheType++)
00239 {
00240 if (pCacheType->RefCount == 0) // Nobody is using this slot yet
00241 break;
00242 }
00243
00244 if (i == D3DCACHE_MAX_CACHE_TYPES) // No types left
00245 return NULL;
00246
00247 assert(pCacheType->Slots == NULL);
00248 assert(pCacheType->NumUsedSlots == 0);
00249
00250 pCacheType->Width = Width;
00251 pCacheType->Height = Height;
00252 pCacheType->NumMipLevels = NumMipLevels;
00253 pCacheType->Stage = Stage;
00254 pCacheType->ddsd = *ddsd;
00255
00256 pCacheType->SelfCheck = pCacheType;
00257 pCacheType->Cache = Cache;
00258
00259 pCacheType->Log = GetLog(Width, Height);
00260
00261 // Found one
00262 pCacheType->RefCount++;
00263
00264 return pCacheType;
00265 }
|
|
|
Definition at line 150 of file D3D7xDrv/D3dcache.cpp. References GE_FALSE, GE_TRUE, geBoolean, and D3DCache::SelfCheck. Referenced by D3DCache_AdjustSlots(), D3DCache_EvictAllSurfaces(), D3DCache_FindCacheType(), D3DCache_FreeAllSlots(), D3DCache_InsertCacheType(), D3DCache_SetupSlot(), D3DCache_TypeCreate(), and D3DCache_TypeIsValid().
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 594 of file D3D7xDrv/D3dcache.cpp. References D3DCache_IsValid(), D3DCache_SlotIsValid(), int32, D3DCache::lpDD, NULL, D3DCache_Slot::Surface, and D3DCache_Slot::Texture. Referenced by D3DCache_AdjustSlots().
00595 {
00596 /* 07/16/2000 Wendell Buckner
00597 Convert to Directx7...
00598 LPDIRECTDRAWSURFACE4 Surface; */
00599 LPDIRECTDRAWSURFACE7 Surface;
00600
00601 DDSURFACEDESC2 ddsd;
00602 HRESULT Hr;
00603
00604 assert(D3DCache_IsValid(Cache));
00605 assert(D3DCache_SlotIsValid(Slot));
00606
00607 memcpy(&ddsd, SurfDesc, sizeof(DDSURFACEDESC2));
00608
00609 ddsd.dwSize = sizeof(DDSURFACEDESC2);
00610 ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
00611
00612 if (UseStage)
00613 ddsd.dwFlags |= DDSD_TEXTURESTAGE;
00614
00615 ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM;
00616 ddsd.ddsCaps.dwCaps2 = DDSCAPS2_HINTDYNAMIC;
00617 ddsd.ddsCaps.dwCaps3 = 0;
00618 ddsd.ddsCaps.dwCaps4 = 0;
00619 ddsd.dwHeight = Width;
00620 ddsd.dwWidth = Height;
00621
00622 ddsd.dwTextureStage = Stage;
00623
00624 Hr = Cache->lpDD->CreateSurface(&ddsd, &Surface, NULL);
00625
00626 if(Hr != DD_OK)
00627 {
00628 if (Hr == DDERR_OUTOFVIDEOMEMORY)
00629 {
00630 return 0;
00631 }
00632
00633 return -1;
00634 }
00635
00636 Slot->Surface = Surface;
00637
00638 // Set the color key
00639 #if 0
00640 {
00641 DDCOLORKEY CKey;
00642
00643 // Create the color key for this surface
00644 CKey.dwColorSpaceLowValue = 1;
00645 CKey.dwColorSpaceHighValue = 1;
00646
00647 if (Slot->Surface->SetColorKey(DDCKEY_SRCBLT , &CKey) != DD_OK)
00648 {
00649 Slot->Surface->Release();
00650 Slot->Surface = NULL;
00651 return -1;
00652 }
00653 }
00654 #endif
00655
00656 /* 02/25/2001 Wendell Buckner
00657 This texture pointer is no longer valid under directx 7. Set it to TRUE so there is
00658 something there when the code does assert checks.
00659 Hr = Surface->QueryInterface(IID_IDirect3DTexture2, (void**)&Slot->Texture);
00660
00661 if(Hr != DD_OK)
00662 {
00663 Surface->Release();
00664 return -1;
00665 }*/
00666 Slot->Texture = Surface;
00667
00668 return 1; // All good dude
00669 }
|
|
|
Definition at line 739 of file D3D7xDrv/D3dcache.cpp. References D3DCache_SlotIsValid(), D3DCache_Slot::LRU, and uint32.
00740 {
00741 assert(D3DCache_SlotIsValid(Slot));
00742
00743 return Slot->LRU;
00744 }
|
|
|
Definition at line 759 of file D3D7xDrv/D3dcache.cpp. References D3DCache_SlotIsValid(), and D3DCache_Slot::Surface. Referenced by SetupLMap(), and SetupTexture().
00760 {
00761 assert(D3DCache_SlotIsValid(Slot));
00762
00763 return Slot->Surface;
00764 }
|
|
|
Definition at line 749 of file D3D7xDrv/D3dcache.cpp. References D3DCache_SlotIsValid(), and D3DCache_Slot::Texture. Referenced by SetupLMap(), and SetupTexture().
00750 {
00751 assert(D3DCache_SlotIsValid(Slot));
00752
00753 return Slot->Texture;
00754 }
|
|
|
Definition at line 719 of file D3D7xDrv/D3dcache.cpp. References D3DCache_SlotIsValid(), and D3DCache_Slot::UserData. Referenced by SetupMipData().
00720 {
00721 assert(D3DCache_SlotIsValid(Slot));
00722
00723 return Slot->UserData;
00724 }
|
|
|
Definition at line 576 of file D3D7xDrv/D3dcache.cpp. References GE_FALSE, GE_TRUE, geBoolean, and D3DCache_Slot::SelfCheck. Referenced by D3DCache_FreeAllSlots(), D3DCache_SetupSlot(), D3DCache_SlotGetLRU(), D3DCache_SlotGetSurface(), D3DCache_SlotGetTexture(), D3DCache_SlotGetUserData(), D3DCache_SlotSetLRU(), D3DCache_SlotSetUserData(), D3DCache_TypeDestroy(), and D3DCache_TypeFindSlot().
|
|
||||||||||||
|
Definition at line 729 of file D3D7xDrv/D3dcache.cpp. References D3DCache_SlotIsValid(), and D3DCache_Slot::LRU. Referenced by SetupLMap(), and SetupTexture().
00730 {
00731 assert(D3DCache_SlotIsValid(Slot));
00732
00733 Slot->LRU = LRU;
00734 }
|
|
||||||||||||
|
Definition at line 709 of file D3D7xDrv/D3dcache.cpp. References D3DCache_SlotIsValid(), and D3DCache_Slot::UserData. Referenced by D3DCache_EvictAllSurfaces(), and SetupMipData().
00710 {
00711 assert(D3DCache_SlotIsValid(Slot));
00712
00713 Slot->UserData = UserData;
00714 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 269 of file D3D7xDrv/D3dcache.cpp. References D3DCache_FindCacheType(), D3DCache_InsertCacheType(), D3DCache_IsValid(), and D3DCache_Type::RefCount. Referenced by Create3DTHandle(), and CreateLightmapTHandle().
00270 {
00271 D3DCache_Type *CacheType;
00272
00273 assert(D3DCache_IsValid(Cache));
00274
00275 CacheType = D3DCache_FindCacheType(Cache, Width, Height, NumMipLevels, Stage, ddsd);
00276
00277 if (CacheType)
00278 {
00279 CacheType->RefCount++;
00280 return CacheType;
00281 }
00282
00283 // Could not find one allready in the list, so add a new one...
00284 return D3DCache_InsertCacheType(Cache, Width, Height, NumMipLevels, Stage, ddsd);
00285 }
|
|
|
Definition at line 290 of file D3D7xDrv/D3dcache.cpp. References D3DCache_SlotIsValid(), D3DCache_TypeIsValid(), int32, NULL, D3DCache_Type::NumUsedSlots, D3DCache_Type::RefCount, D3DCache_Type::Slots, D3DCache_Slot::Surface, and D3DCache_Slot::Texture. Referenced by THandle_Destroy().
00291 {
00292 assert(CacheType->RefCount > 0);
00293 assert(D3DCache_TypeIsValid(CacheType));
00294
00295 CacheType->RefCount--;
00296
00297 if (CacheType->RefCount == 0)
00298 {
00299 if (CacheType->Slots)
00300 {
00301 D3DCache_Slot *pSlot;
00302 int32 k;
00303
00304 // Go through each slot, and free all the surfaces on them
00305 for (pSlot = CacheType->Slots, k=0; k< CacheType->NumUsedSlots; k++, pSlot++)
00306 {
00307 assert(D3DCache_SlotIsValid(pSlot));
00308 assert(pSlot->Surface);
00309 assert(pSlot->Texture);
00310
00311 /* 02/25/2001 Wendell Buckner
00312 /* This texture pointer is no longer valid under directx 7. Set it to TRUE so there is
00313 /* something there when the code does assert checks.
00314 if (pSlot->Texture)
00315 pSlot->Texture->Release();*/
00316 if (pSlot->Surface)
00317 pSlot->Surface->Release();
00318 }
00319
00320 free(CacheType->Slots);
00321 CacheType->Slots = NULL;
00322 CacheType->NumUsedSlots = 0;
00323 }
00324 }
00325 }
|
|
|
Definition at line 675 of file D3D7xDrv/D3dcache.cpp. References D3DCache_SlotIsValid(), D3DCache_TypeIsValid(), int32, D3DCache_Slot::LRU, NULL, D3DCache_Type::NumUsedSlots, D3DCache_Type::Slots, uint32, and D3DCache_Slot::UserData. Referenced by SetupMipData().
00676 {
00677 D3DCache_Slot *pBestSlot, *pSlot;
00678 uint32 BestLRU;
00679 int32 i;
00680
00681 assert(D3DCache_TypeIsValid(CacheType));
00682
00683 assert(CacheType->Slots);
00684
00685 pSlot = CacheType->Slots;
00686 pBestSlot = pSlot;
00687 BestLRU = pBestSlot->LRU;
00688
00689 for (i=0; i< CacheType->NumUsedSlots; i++, pSlot++)
00690 {
00691 assert(D3DCache_SlotIsValid(pSlot));
00692
00693 if (pSlot->LRU < BestLRU)
00694 {
00695 pBestSlot = pSlot;
00696 BestLRU = pSlot->LRU;
00697 }
00698 }
00699
00700 pBestSlot->LRU = 0;
00701 pBestSlot->UserData = NULL;
00702
00703 return pBestSlot;
00704 }
|
|
|
Definition at line 330 of file D3D7xDrv/D3dcache.cpp. References D3DCache_Type::Cache, D3DCache_IsValid(), GE_FALSE, GE_TRUE, geBoolean, and D3DCache_Type::SelfCheck. Referenced by D3DCache_EvictAllSurfaces(), D3DCache_FindCacheType(), D3DCache_FreeAllSlots(), D3DCache_TypeDestroy(), and D3DCache_TypeFindSlot().
|
|
||||||||||||
|
Definition at line 817 of file D3D7xDrv/D3dcache.cpp. References int32, Log2(), max, and SnapToPower2(). Referenced by Create2DTHandle(), Create3DTexture(), Create3DTHandle(), CreateLightmapTexture(), CreateLightmapTHandle(), D3DCache_InsertCacheType(), and THandle_Create().
00818 {
00819 int32 LWidth = SnapToPower2(max(Width, Height));
00820
00821 return Log2(LWidth);
00822 }
|
|
|
Definition at line 770 of file D3D7xDrv/D3dcache.cpp. Referenced by GetLog().
|
|
|
Definition at line 785 of file D3D7xDrv/D3dcache.cpp. References int32. Referenced by Create3DTexture(), CreateTexture(), DrawDecal(), GetLog(), GTHandle_SetupInfo(), and THandle_Create().
00786 {
00787 #if 1
00788 if (Width > 0 && Width <= 1) Width = 1;
00789 else if (Width > 1 && Width <= 2) Width = 2;
00790 else if (Width > 2 && Width <= 4) Width = 4;
00791 else if (Width > 4 && Width <= 8) Width = 8;
00792 else if (Width > 8 && Width <= 16) Width =16;
00793 else if (Width > 16 && Width <= 32) Width = 32;
00794 else if (Width > 32 && Width <= 64) Width = 64;
00795 else if (Width > 64 && Width <= 128) Width = 128;
00796 else if (Width > 128 && Width <= 256) Width = 256;
00797 else
00798 return -1;
00799 #else
00800
00801 if (Width > 1 && Width <= 8) Width = 8;
00802 else if (Width > 8 && Width <= 16) Width =16;
00803 else if (Width > 16 && Width <= 32) Width = 32;
00804 else if (Width > 32 && Width <= 64) Width = 64;
00805 else if (Width > 64 && Width <= 128) Width = 128;
00806 else if (Width > 128 && Width <= 256) Width = 256;
00807 else
00808 return -1;
00809 #endif
00810
00811 return Width;
00812 }
|
1.3.2