|
resonance 1.0.1
|
One entry of the GS video memory block table. More...
#include <vram.h>

Public Member Functions | |
| void | MakeFree (unsigned short nMemAddr, unsigned short nBlocks) |
| Mark the record as a free run of the given size. | |
| void | Reset () |
| Forget which blocks the record described. | |
| void | SetPinned (int bPinned) |
| Pin the record against eviction, or release the pin. | |
| void | SetupSurface (int nWidth, int nHeight, int nBitsPerPixel, int nPsm, int nKind) |
| Size the record for an image and put it on the used list, without allocating any blocks. | |
| int | ComputeBlockSize (int nWidth, int nHeight, int nBitsPerPixel, int nPsm) const |
| Blocks an image of the given shape occupies. | |
| int | GetBlockAddr () |
| Mark the record as used this packet and return the GS address of its blocks. | |
| int | UploadImage (const void *pSource, int nWidth, int nHeight, int nBitsPerPixel, int nPsm) |
| Move an image into the record's blocks, allocating them first if the record is not resident. | |
| void | UploadSubImage (const void *pSource, int nWidth, int nHeight, int nBitsPerPixel, int nPsm, int nBlockOffset) |
| Move an image into the record's blocks at an offset, without allocating. | |
| void | FreeSelf () |
| Release the record, returning its blocks to the free list and itself to the pool. | |
Public Attributes | |
| unsigned short | mMemAddr |
| First block of the run, zero while the record is not resident. | |
| unsigned short | mSize |
| Blocks in the run. | |
| unsigned char | mKind |
| One of VramBlockKind. | |
| unsigned char | mLockMask |
| Generation bits plus kVramLockPinned. | |
| unsigned short | mReserved06 |
| int | mLastUsed |
| Value of VRAM::mFlushCount at the last GetBlockAddr(). | |
| Entry * | mpPrev |
| Previous record on whichever of the three lists this record is on. | |
| Entry * | mpNext |
| Next record on the same list. | |
| Entry * | mpLower |
| Record describing the run immediately below this one, or null at the bottom. | |
| Entry * | mpUpper |
| Record describing the run immediately above this one, or null at the top. | |
One entry of the GS video memory block table.
The class is not polymorphic and has no RTTI. Its name comes from the debugging symbols of the North American demo release. The demo's SetUnused() and InitRaw() have the same instructions as Reset() and MakeFree(). Of the members, only mMemAddr, mpPrev, and mpNext are attested by a literal, the first two through the sibling diagnostic "Pal entry in chain has mMemAddr of 0 (mpPrev: %p, mpNext: %p)" and the parallel layout of the two records. Every other title is inferred from use.
A record describes a run of blocks at mMemAddr, whether that run is free or owned by a surface. It appears on exactly one of the three lists through mpPrev and mpNext, and separately on the address ordered chain through mpLower and mpUpper. The chain is what lets a freed run merge with the runs on either side of it.
The image records no access control. Every member and method below is reached from VRAM or from Rnd::PsTex. A friend declaration fits the image as well as the public section written here.
| void Rnd::VRAM::Entry::MakeFree | ( | unsigned short | nMemAddr, |
| unsigned short | nBlocks ) |
Mark the record as a free run of the given size.
| nMemAddr | First block of the run. |
| nBlocks | Blocks in the run. |
| void Rnd::VRAM::Entry::Reset | ( | ) |
Forget which blocks the record described.
| void Rnd::VRAM::Entry::SetPinned | ( | int | bPinned | ) |
Pin the record against eviction, or release the pin.
| bPinned | Non-zero to pin. |
| void Rnd::VRAM::Entry::SetupSurface | ( | int | nWidth, |
| int | nHeight, | ||
| int | nBitsPerPixel, | ||
| int | nPsm, | ||
| int | nKind ) |
Size the record for an image and put it on the used list, without allocating any blocks.
The record starts non-resident, with mMemAddr zero, so the first GetBlockAddr() counts a miss and the first UploadImage() allocates.
| nWidth | Image width in texels. |
| nHeight | Image height in texels. |
| nBitsPerPixel | Bits per texel. The routine does not read it. |
| nPsm | GS pixel storage mode. |
| nKind | One of VramBlockKind. |
| int Rnd::VRAM::Entry::ComputeBlockSize | ( | int | nWidth, |
| int | nHeight, | ||
| int | nBitsPerPixel, | ||
| int | nPsm ) const |
Blocks an image of the given shape occupies.
The count is whole GS pages, because the allocator works in pages rather than in texels. The page shape follows the storage mode, 128 by 128 texels for four-bit, 128 by 64 for eight-bit, 64 by 64 for sixteen-bit, and 64 by 32 for everything else.
| nWidth | Image width in texels. |
| nHeight | Image height in texels. |
| nBitsPerPixel | Bits per texel. The routine does not read it. |
| nPsm | GS pixel storage mode. |
| int Rnd::VRAM::Entry::GetBlockAddr | ( | ) |
Mark the record as used this packet and return the GS address of its blocks.
The first call within a packet adds the record to the current generation's lock list, which protects it from eviction until the generation comes round again. A record with no blocks counts a miss and returns zero, and the caller is expected to upload.
| int Rnd::VRAM::Entry::UploadImage | ( | const void * | pSource, |
| int | nWidth, | ||
| int | nHeight, | ||
| int | nBitsPerPixel, | ||
| int | nPsm ) |
Move an image into the record's blocks, allocating them first if the record is not resident.
| pSource | Texels to move, or null to allocate without transferring. |
| nWidth | Image width in texels. |
| nHeight | Image height in texels. |
| nBitsPerPixel | Bits per texel. The routine does not read it. |
| nPsm | GS pixel storage mode. |
| void Rnd::VRAM::Entry::UploadSubImage | ( | const void * | pSource, |
| int | nWidth, | ||
| int | nHeight, | ||
| int | nBitsPerPixel, | ||
| int | nPsm, | ||
| int | nBlockOffset ) |
Move an image into the record's blocks at an offset, without allocating.
A mip chain uses it for every level after the first.
| pSource | Texels to move. |
| nWidth | Image width in texels. |
| nHeight | Image height in texels. |
| nBitsPerPixel | Bits per texel. The routine does not read it. |
| nPsm | GS pixel storage mode. |
| nBlockOffset | Blocks past mMemAddr to write at. |
| void Rnd::VRAM::Entry::FreeSelf | ( | ) |
Release the record, returning its blocks to the free list and itself to the pool.
| unsigned short Rnd::VRAM::Entry::mMemAddr |
First block of the run, zero while the record is not resident.
Attested.
| unsigned short Rnd::VRAM::Entry::mSize |
Blocks in the run.
| unsigned char Rnd::VRAM::Entry::mKind |
One of VramBlockKind.
| unsigned char Rnd::VRAM::Entry::mLockMask |
Generation bits plus kVramLockPinned.
The literals write it "lockmask".
| unsigned short Rnd::VRAM::Entry::mReserved06 |
No instruction reads or writes it. +0x06
| int Rnd::VRAM::Entry::mLastUsed |
Value of VRAM::mFlushCount at the last GetBlockAddr().
| Entry* Rnd::VRAM::Entry::mpPrev |
Previous record on whichever of the three lists this record is on.
Attested.
| Entry* Rnd::VRAM::Entry::mpNext |
Next record on the same list.
Attested.
| Entry* Rnd::VRAM::Entry::mpLower |
Record describing the run immediately below this one, or null at the bottom.
| Entry* Rnd::VRAM::Entry::mpUpper |
Record describing the run immediately above this one, or null at the top.