- Main Page
- Classes
- Files

- File List
- File Members

# flMemoryVMem.h File Reference

`#include "flGlobal.h"`
`#include "flMemory.h"`

Go to the source code of this file.

## Classes
struct | VmemStrideBlock
## Defines
#define | MEMORY_VMEM_BASE 0x04000000
#define | MEMORY_VMEM_SIZE 0x00200000
#define | vmemNormalPointer(inPtr) vmemNormalPtr(inPtr)
#define | vmemAlloc(inSize) vmemAllocFrom(inSize, __FILE__, __FUNCTION__, __LINE__)
#define | vmemCalloc(inSize0, inSize1) vmemCallocFrom(inSize0, inSize1, __FILE__, __FUNCTION__, __LINE__)
#define | vmemRealloc(inData, inSize) vmemReallocFrom(inData, inSize, __FILE__, __FUNCTION__, __LINE__)
#define | vmemFree(inData) vmemFreeFrom(inData, __FILE__, __FUNCTION__, __LINE__)
#define | vmemAbsolutePtr(inPtr) ((void*)((unsigned int)(inPtr) | MEMORY_VMEM_BASE))
#define | vmemRelativePtr(inPtr) ((void*)((unsigned int)(inPtr) & ~MEMORY_VMEM_BASE))
#define | vmemPtr(inPtr) (((unsigned int)memCachedPtr(inPtr) >= MEMORY_VMEM_BASE) && ((unsigned int)memCachedPtr(inPtr) < (MEMORY_VMEM_BASE + (MEMORY_VMEM_SIZE << 2))))
#define | vmemAbsPtr(inPtr) vmemAbsolutePtr(inPtr)
#define | vmemRelPtr(inPtr) vmemRelativePtr(inPtr)
#define | vmemAbsolutePointer(inPtr) vmemAbsolutePtr(inPtr)
#define | vmemRelativePointer(inPtr) vmemRelativePtr(inPtr)
#define | vmemPointer(inPtr) vmemPtr(inPtr)
## Functions
void | vmemInit ()
void | vmemTerm ()
void * | vmemNormalPtr (void *inPtr)
u32 | vmemFreeSpace ()
u32 | vmemLargestFreeBlock ()
float | vmemFragmentation ()
void * | vmemAllocBuffer (u32 inWidth, u32 inHeight, u8 inBitDepth, u32 inStride)
void * | vmemAllocFrom (u32 inSize, const char *inFile, const char *inFunc, int inLine)
void * | vmemCallocFrom (u32 inSize0, u32 inSize1, const char *inFile, const char *inFunc, int inLine)
void * | vmemReallocFrom (void *inData, u32 inSize, const char *inFile, const char *inFunc, int inLine)
void | vmemFreeFrom (void *inData, const char *inFile, const char *inFunc, int inLine)
void | vmemStrideBlockAdd (void *inStart, u32 inStride, u32 inBlockSize, u32 inBlockCount)
void | vmemStrideBlockDel (VmemStrideBlock *inBlock)
void | vmemStrideBlockDelRecursive (VmemStrideBlock *inBlock)
void * | vmemStrideAlign (u32 inAlign, u32 inSize)
void * | vmemStrideAlloc (u32 inSize)
void * | vmemStrideCalloc (u32 inSize0, u32 inSize1)
bool | vmemStrideFree (void *inData)
float | vmemStrideUsage ()
u32 | vmemStrideFreeSpace ()
## Variables
u32 | vmemStart
u32 | vmemSize
u32 * | vmemBlockTable
u32 | vmemBlocks
u32 | vmemFreeBlocks
bool | vmemInitialized
VmemStrideBlock * | vmemStrideBlocks

## Define Documentation

#define MEMORY_VMEM_BASE 0x04000000

Definition at line 15 of file flMemoryVMem.h.

Referenced by memAddressValid(), memBlockValid(), vmemNormalPtr(), and vmemTerm().

#define MEMORY_VMEM_SIZE 0x00200000

Definition at line 16 of file flMemoryVMem.h.

Referenced by memAddressValid(), memBlockValid(), vmemAllocBuffer(), vmemNormalPtr(), and vmemTerm().

#define vmemAbsolutePointer | ( | inPtr |  | ) | vmemAbsolutePtr(inPtr)

Definition at line 95 of file flMemoryVMem.h.

#define vmemAbsolutePtr | ( | inPtr |  | ) | ((void*)((unsigned int)(inPtr) | MEMORY_VMEM_BASE))

Definition at line 90 of file flMemoryVMem.h.

Referenced by graphics2dDrawTexture(), graphics2dDrawTextureSection(), graphicsEffectFsColorEnhance(), graphicsEffectFsDepthFog(), graphicsEffectFsDichrome(), graphicsEffectFsGlow(), graphicsEffectFsGrayscale(), graphicsEffectFsGrayscaleSW(), graphicsEffectFsInvert(), graphicsEffectFsLightEnhance(), graphicsEffectFsMonochrome(), graphicsEffectFsNightVision(), graphicsEffectFsNightVisionSW(), graphicsEffectFsThermalVision(), texScreenshot(), and vmemInit().

#define vmemAbsPtr | ( | inPtr |  | ) | vmemAbsolutePtr(inPtr)

Definition at line 93 of file flMemoryVMem.h.

#define vmemAlloc | ( | inSize |  | ) | vmemAllocFrom(inSize, __FILE__, __FUNCTION__, __LINE__)

Definition at line 62 of file flMemoryVMem.h.

Referenced by fontCreateDebugTex(), graphicsEffectFsColorEnhance(), graphicsEffectFsDichrome(), graphicsEffectFsGlow(), graphicsEffectFsGrayscale(), graphicsEffectFsInvert(), graphicsEffectFsLightEnhance(), graphicsEffectFsMonochrome(), graphicsEffectFsNightVision(), graphicsEffectFsThermalVision(), memAlignFrom(), memQallocFrom(), palMoveVMem(), texMoveVMem(), vmemAllocBuffer(), vmemAllocFrom(), vmemCallocFrom(), and vmemReallocFrom().

#define vmemCalloc | ( | inSize0,
|  | inSize1 |  | ) | vmemCallocFrom(inSize0, inSize1, __FILE__, __FUNCTION__, __LINE__)

Definition at line 63 of file flMemoryVMem.h.

Referenced by vmemCallocFrom().

#define vmemFree | ( | inData |  | ) | vmemFreeFrom(inData, __FILE__, __FUNCTION__, __LINE__)

Definition at line 65 of file flMemoryVMem.h.

Referenced by graphicsEffectFsColorEnhance(), graphicsEffectFsDichrome(), graphicsEffectFsGlow(), graphicsEffectFsGrayscale(), graphicsEffectFsInvert(), graphicsEffectFsLightEnhance(), graphicsEffectFsMonochrome(), graphicsEffectFsNightVision(), graphicsEffectFsThermalVision(), memFreeFrom(), vmemFreeFrom(), and vmemReallocFrom().

#define vmemNormalPointer | ( | inPtr |  | ) | vmemNormalPtr(inPtr)

Definition at line 50 of file flMemoryVMem.h.

#define vmemPointer | ( | inPtr |  | ) | vmemPtr(inPtr)

Definition at line 97 of file flMemoryVMem.h.

Referenced by memFreeFrom(), and memReallocFrom().

#define vmemPtr | ( | inPtr |  | ) | (((unsigned int)memCachedPtr(inPtr) >= MEMORY_VMEM_BASE) && ((unsigned int)memCachedPtr(inPtr) < (MEMORY_VMEM_BASE + (MEMORY_VMEM_SIZE << 2))))

Definition at line 92 of file flMemoryVMem.h.

#define vmemRealloc | ( | inData,
|  | inSize |  | ) | vmemReallocFrom(inData, inSize, __FILE__, __FUNCTION__, __LINE__)

Definition at line 64 of file flMemoryVMem.h.

Referenced by memReallocFrom(), and vmemReallocFrom().

#define vmemRelativePointer | ( | inPtr |  | ) | vmemRelativePtr(inPtr)

Definition at line 96 of file flMemoryVMem.h.

#define vmemRelativePtr | ( | inPtr |  | ) | ((void*)((unsigned int)(inPtr) & ~MEMORY_VMEM_BASE))

Definition at line 91 of file flMemoryVMem.h.

Referenced by graphicsEffectFsColorEnhance(), graphicsEffectFsDichrome(), graphicsEffectFsGlow(), graphicsEffectFsGrayscale(), graphicsEffectFsInvert(), graphicsEffectFsLightEnhance(), graphicsEffectFsMonochrome(), graphicsEffectFsNightVision(), graphicsEffectFsThermalVision(), vmemAllocBuffer(), and vmemReallocFrom().

#define vmemRelPtr | ( | inPtr |  | ) | vmemRelativePtr(inPtr)

Definition at line 94 of file flMemoryVMem.h.

## Function Documentation

void* vmemAllocBuffer | ( | u32 | inWidth,
|  | u32 | inHeight,
|  | u8 | inBitDepth,
|  | u32 | inStride |
| ) |  |  |

Definition at line 97 of file flMemoryVMem.c.

References debugDevWarning, debugError, MEMORY_VMEM_SIZE, vmemAlloc, vmemInitialized, vmemRelativePtr, vmemSize, vmemStart, and vmemStrideBlockAdd().

Referenced by graphicsInit(), and vmemInit().

void* vmemAllocFrom | ( | u32 | inSize,
|  | const char * | inFile,
|  | const char * | inFunc,
|  | int | inLine |
| ) |  |  |

Definition at line 126 of file flMemoryVMem.c.

References debugWarning, debugWarningFrom(), FL_MEMORY_VMEM_BLOCKSIZE, NULL, vmemAlloc, vmemBlocks, vmemBlockTable, vmemFreeBlocks, vmemInitialized, vmemStart, and vmemStrideAlloc().

Referenced by vmemCallocFrom().

void* vmemCallocFrom | ( | u32 | inSize0,
|  | u32 | inSize1,
|  | const char * | inFile,
|  | const char * | inFunc,
|  | int | inLine |
| ) |  |  |

Definition at line 216 of file flMemoryVMem.c.

References memClear, NULL, vmemAlloc, vmemAllocFrom(), vmemCalloc, and vmemStrideCalloc().

float vmemFragmentation | ( |  | ) |

Definition at line 376 of file flMemoryVMem.c.

References debugWarning, FL_MEMORY_VMEM_BLOCKSIZE, vmemBlocks, vmemBlockTable, vmemFreeSpace(), and vmemInitialized.

void vmemFreeFrom | ( | void * | inData,
|  | const char * | inFile,
|  | const char * | inFunc,
|  | int | inLine |
| ) |  |  |

Definition at line 290 of file flMemoryVMem.c.

References debugError, debugErrorFrom(), FL_DEBUG_CALLEDFROM, FL_DEBUG_ERROR, FL_MEMORY_VMEM_BLOCKSIZE, vmemBlocks, vmemBlockTable, vmemFree, vmemFreeBlocks, vmemInitialized, vmemNormalPtr(), vmemSize, vmemStart, and vmemStrideFree().

Referenced by memFreeFrom().

u32 vmemFreeSpace | ( |  | ) |

Definition at line 353 of file flMemoryVMem.c.

References FL_MEMORY_VMEM_BLOCKSIZE, vmemFreeBlocks, and vmemStrideFreeSpace().

Referenced by memFreeSpaceTotal(), and vmemFragmentation().

void vmemInit | ( |  | ) |

Definition at line 29 of file flMemoryVMem.c.

References debugWarning, FL_MEMORY_VMEM_BLOCKSIZE, FL_MEMORY_VMEM_CACHE, memAlloc, memUncachedPtr, vmemAbsolutePtr, vmemAllocBuffer(), vmemBlocks, vmemBlockTable, vmemCache, vmemFreeBlocks, vmemInitialized, vmemSize, and vmemStart.

Referenced by graphicsInit().

u32 vmemLargestFreeBlock | ( |  | ) |

Definition at line 357 of file flMemoryVMem.c.

References debugWarning, FL_MEMORY_VMEM_BLOCKSIZE, vmemBlocks, and vmemBlockTable.

void* vmemNormalPtr | ( | void * | inPtr | ) |

Definition at line 82 of file flMemoryVMem.c.

References memCachedPtr, MEMORY_VMEM_BASE, MEMORY_VMEM_SIZE, and NULL.

Referenced by vmemFreeFrom(), vmemStrideBlockAdd(), and vmemStrideFree().

void* vmemReallocFrom | ( | void * | inData,
|  | u32 | inSize,
|  | const char * | inFile,
|  | const char * | inFunc,
|  | int | inLine |
| ) |  |  |

Definition at line 237 of file flMemoryVMem.c.

References debugDevWarning, debugDevWarningFrom(), debugError, debugErrorFrom(), debugWarning, debugWarningFrom(), FL_MEMORY_VMEM_BLOCKSIZE, memCachedPtr, memCopy, NULL, vmemAlloc, vmemBlocks, vmemBlockTable, vmemFree, vmemRealloc, vmemRelativePtr, and vmemStart.

void* vmemStrideAlign | ( | u32 | inAlign,
|  | u32 | inSize |
| ) |  |  |

Definition at line 456 of file flMemoryVMem.c.

References FL_MEMORY_ALIGNMENT_DEFAULT, flRunning, NULL, vmemStrideBlocks, VmemStrideBlock::vmsbBlockAlign, VmemStrideBlock::vmsbBlockCount, VmemStrideBlock::vmsbBlockSize, VmemStrideBlock::vmsbBlockTable, and VmemStrideBlock::vmsbNext.

Referenced by memAlignFrom(), and vmemStrideAlloc().

void* vmemStrideAlloc | ( | u32 | inSize | ) |

Definition at line 492 of file flMemoryVMem.c.

References FL_MEMORY_ALIGNMENT_DEFAULT, and vmemStrideAlign().

Referenced by vmemAllocFrom(), and vmemStrideCalloc().

void vmemStrideBlockAdd | ( | void * | inStart,
|  | u32 | inStride,
|  | u32 | inBlockSize,
|  | u32 | inBlockCount |
| ) |  |  |

Definition at line 396 of file flMemoryVMem.c.

References debugWarning, memAddressAlignment(), memAlloc, memBlockValid(), memClear, min, NULL, vmemNormalPtr(), vmemStrideBlocks, VmemStrideBlock::vmsbBlockAlign, VmemStrideBlock::vmsbBlockCount, VmemStrideBlock::vmsbBlockSize, VmemStrideBlock::vmsbBlockTable, VmemStrideBlock::vmsbLast, VmemStrideBlock::vmsbNext, VmemStrideBlock::vmsbStart, and VmemStrideBlock::vmsbStride.

Referenced by vmemAllocBuffer().

void vmemStrideBlockDel | ( | VmemStrideBlock * | inBlock | ) |

Definition at line 434 of file flMemoryVMem.c.

References memFree, vmemStrideBlocks, VmemStrideBlock::vmsbLast, and VmemStrideBlock::vmsbNext.

void vmemStrideBlockDelRecursive | ( | VmemStrideBlock * | inBlock | ) |

Definition at line 444 of file flMemoryVMem.c.

References memFree, vmemStrideBlockDelRecursive(), VmemStrideBlock::vmsbLast, and VmemStrideBlock::vmsbNext.

Referenced by vmemStrideBlockDelRecursive(), and vmemTerm().

void* vmemStrideCalloc | ( | u32 | inSize0,
|  | u32 | inSize1 |
| ) |  |  |

Definition at line 496 of file flMemoryVMem.c.

References memClear, and vmemStrideAlloc().

Referenced by vmemCallocFrom().

bool vmemStrideFree | ( | void * | inData | ) |

Definition at line 502 of file flMemoryVMem.c.

References debugWarning, flRunning, vmemNormalPtr(), vmemStrideBlocks, VmemStrideBlock::vmsbBlockCount, VmemStrideBlock::vmsbBlockSize, VmemStrideBlock::vmsbBlockTable, VmemStrideBlock::vmsbNext, VmemStrideBlock::vmsbStart, and VmemStrideBlock::vmsbStride.

Referenced by vmemFreeFrom().

u32 vmemStrideFreeSpace | ( |  | ) |

Definition at line 563 of file flMemoryVMem.c.

References flRunning, vmemStrideBlocks, VmemStrideBlock::vmsbBlockCount, VmemStrideBlock::vmsbBlockSize, VmemStrideBlock::vmsbBlockTable, and VmemStrideBlock::vmsbNext.

Referenced by vmemFreeSpace().

float vmemStrideUsage | ( |  | ) |

Definition at line 534 of file flMemoryVMem.c.

References flRunning, vmemStrideBlocks, VmemStrideBlock::vmsbBlockCount, VmemStrideBlock::vmsbBlockSize, VmemStrideBlock::vmsbBlockTable, and VmemStrideBlock::vmsbNext.

void vmemTerm | ( |  | ) |

Definition at line 67 of file flMemoryVMem.c.

References debugWarning, memFree, MEMORY_VMEM_BASE, MEMORY_VMEM_SIZE, vmemBlocks, vmemBlockTable, vmemInitialized, vmemSize, vmemStart, vmemStrideBlockDelRecursive(), and vmemStrideBlocks.

Referenced by graphicsTerm().

## Variable Documentation

u32 vmemBlocks

Definition at line 19 of file flMemoryVMem.c.

Referenced by vmemAllocFrom(), vmemFragmentation(), vmemFreeFrom(), vmemInit(), vmemLargestFreeBlock(), vmemReallocFrom(), and vmemTerm().

u32* vmemBlockTable

Definition at line 18 of file flMemoryVMem.c.

Referenced by vmemAllocFrom(), vmemFragmentation(), vmemFreeFrom(), vmemInit(), vmemLargestFreeBlock(), vmemReallocFrom(), and vmemTerm().

u32 vmemFreeBlocks

Definition at line 20 of file flMemoryVMem.c.

Referenced by vmemAllocFrom(), vmemFreeFrom(), vmemFreeSpace(), and vmemInit().

bool vmemInitialized

Definition at line 21 of file flMemoryVMem.c.

Referenced by memQallocFrom(), vmemAllocBuffer(), vmemAllocFrom(), vmemFragmentation(), vmemFreeFrom(), vmemInit(), and vmemTerm().

u32 vmemSize

Definition at line 17 of file flMemoryVMem.c.

Referenced by vmemAllocBuffer(), vmemFreeFrom(), vmemInit(), and vmemTerm().

u32 vmemStart

Definition at line 16 of file flMemoryVMem.c.

Referenced by vmemAllocBuffer(), vmemAllocFrom(), vmemFreeFrom(), vmemInit(), vmemReallocFrom(), and vmemTerm().

VmemStrideBlock* vmemStrideBlocks

Definition at line 27 of file flMemoryVMem.c.

Referenced by vmemStrideAlign(), vmemStrideBlockAdd(), vmemStrideBlockDel(), vmemStrideFree(), vmemStrideFreeSpace(), vmemStrideUsage(), and vmemTerm().