|
wavelength 1.0.0
|
Texture, PlayStation 2. More...
#include <pstex.h>


Classes | |
| struct | FreeRange |
| A run of free GS blocks. More... | |
| struct | UsedRange |
| The GS blocks of the CLUT or of one mipmap. More... | |
Public Member Functions | |
| PsTex (const char *pszName) | |
| Construct a texture without GS blocks. | |
| ~PsTex () override | |
| Release the GS blocks and the movie packet. | |
| void * | operator new (size_t nSize) |
| Allocate a texture from its pool. | |
| void | operator delete (void *pBlock) |
| Return a texture to its pool. | |
| RndBitmap * | LockBitmap (int nFlags) override |
| Give access to the bitmap, recording the access for UnlockBitmap(). | |
| void | UnlockBitmap () override |
| Mark the first range for upload, and the second as well when the palette changed. | |
| void | SyncBitmap () override |
| Load the bitmap, then build the GS registers and the ranges for it. | |
| void | ResetBitmap () override |
| Release the GS blocks, then the bitmap. | |
| void | Place () |
| Give each range without blocks its blocks and mark it for upload. | |
| void | BuildMoviePacket (bool bBuild) |
| Release the movie packet, then build one for the current bitmap when requested. | |
| void | UploadMovie () |
| Copy the movie packet into the frame, flushing the frame whenever the packet fills it. | |
| void | UploadImage (int nDbp, int nPsm, int nBpp, int nWidth, int nHeight, const unsigned char *pPixels) |
| Add an image transfer of pixels in main memory to the frame. | |
| void | Upload () |
| Place the ranges, upload those marked for upload, and flush the texture cache. | |
| void | BindAsRenderTarget () |
| Make the first mipmap the surface the GS draws into. | |
| void | SyncRegisters () |
| Build TEX0, TEX1, and the buffer widths of MIPTBP1 and MIPTBP2, and add a range for the CLUT and for each mipmap. | |
| void | ReleaseSurfaces () |
| Release the bitmap and the GS blocks, and empty the ranges. | |
| void | Select (int nTexFunction) |
| Upload the texture when needed, then select it on the GS with a texture function. | |
| Public Member Functions inherited from RndTex | |
| RndTex (const char *pszName) | |
| Construct an empty 32-bit texture without a file. | |
| ~RndTex () override | |
| Release the bitmap. | |
| void * | operator new (size_t nSize) |
| Allocate a texture, billed to the class name. | |
| void | operator delete (void *pBlock) |
| Release a texture. | |
| void | DumpText (PrnStream &stream) override |
| Write a description of the texture, and of its bitmap at a dump level of 2 or more. | |
| void | Save (BinStream &stream) override |
| Write the texture. | |
| void | Replace (RndObject *pFrom, RndObject *pTo) override |
| Do nothing, for a texture refers to no object. | |
| const char * | ClassName () const override |
| Report the class name. | |
| void | Copy (const RndObject *pSource, int nFlags) override |
| Copy the size, the format, and the file of another texture, then load the bitmap again. | |
| void | Load (BinStream &stream) override |
| Read what Save() wrote, or an earlier version of it, then load the bitmap. | |
| void | SetBitmap (int nWidth, int nHeight, int nBpp, const FilePath &file, int nMipMapK, int nRendered) |
| Set the size, the format, and the file, then load the bitmap. | |
| bool | CheckSize () |
| Report whether the size and the format are valid, with a notice when they are not unless a dimension is 0. | |
| const FilePath & | GetFile () const |
| int | GetHeight () const |
| int | GetMipMapK () const |
| int | GetWidth () const |
| Public Member Functions inherited from RndObject | |
| RndObject (const char *pszName) | |
| Construct an object and register it under a name. | |
| virtual | ~RndObject () |
| Notify every referrer, then erase the registration. | |
| void | SetName (const char *pszName) |
| Register the object under a different name. | |
| void | AddRef (RndObject *pReferrer) |
| Register an object as a store of a pointer to this one. | |
| void | RemoveRef (RndObject *pReferrer) |
| Drop the first registration AddRef() made for a referrer. | |
| const char * | GetName () const |
| const std::list< RndObject * > & | GetRefs () const |
| int | GetInternal () const |
| void | SetInternal (int nInternal) |
Static Public Member Functions | |
| static void | BeginFrame () |
| Evict every range not selected since the last call, and record the stamp. | |
| static int | FreeBlockCount () |
| Count the free GS blocks. | |
| static void | ReserveDisplayMemory () |
| Free every block after the display and depth buffers, and evict every range. | |
| static void | FreeBlocks (int nStart, int nCount) |
| Return a run of blocks to the free list, merging it with its neighbours. | |
| static int | NumBlocks (const RndBitmap &bitmap) |
| Report the GS blocks a bitmap occupies, rounded up to the shapes the GS pages allow. | |
| static void | Init () |
| Install the texture factory for the class Tex of a .rnd file, and reset both stamps. | |
| static RndObject * | New (const char *pszName) |
| Create a texture. | |
| Static Public Member Functions inherited from RndTex | |
| static const char * | CheckDim (int nSize) |
| Report what is wrong with a texture dimension. | |
| static RndObject * | New (const char *pszName) |
| Create a texture. | |
Static Public Attributes | |
| static std::list< FreeRange > | sFreeRanges |
| The free runs, in block order. | |
| static std::list< UsedRange * > | sUsedRanges |
| The ranges with blocks, in the order they received them. | |
| static int | sStamp |
| The count of selections, the stamp Select() records on each range. | |
| static int | sEvictStamp |
| The value of sStamp at the last BeginFrame(). | |
| Static Public Attributes inherited from RndTex | |
| static const char * | sClassName |
| The class name a .rnd file writes, Tex. | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
| Static Public Attributes inherited from RndObject | |
| static constexpr int | kCopyChildLists = 0x200 |
| The bit of the Copy() flags that copies the child lists of the mix-ins. | |
Additional Inherited Members | |
| Protected Attributes inherited from RndTex | |
| RndBitmap | mBitmap |
| int | mMipMapK |
| int | mRendered |
| int | mWidth |
| int | mHeight |
| int | mBpp |
| FilePath | mFile |
| Protected Attributes inherited from RndObject | |
| std::list< RndObject * > | mRefs |
| String | mName |
Texture, PlayStation 2.
The RTTI includes the class name and records RndTex as the one base. GS memory is a cache of 16384 blocks of 256 bytes. Each texture has one UsedRange for its CLUT, when it has a palette, and one for each mipmap. A range receives blocks when the texture is next selected, from the free list or, failing that, from a range of another texture that was not selected since the last BeginFrame(). A texture also builds the TEX0, TEX1, MIPTBP1, and MIPTBP2 images it selects.
|
explicit |
Construct a texture without GS blocks.
| pszName | The registry key. |
|
override |
Release the GS blocks and the movie packet.
|
inline |
Allocate a texture from its pool.
| nSize | The object size the compiler supplies. |
|
inline |
Return a texture to its pool.
| pBlock | The block. |
|
overridevirtual |
Give access to the bitmap, recording the access for UnlockBitmap().
| nFlags | The access the caller needs. Bit 2 marks the palette as changed. |
Reimplemented from RndTex.
|
overridevirtual |
Mark the first range for upload, and the second as well when the palette changed.
Reimplemented from RndTex.
|
inlineoverridevirtual |
Load the bitmap, then build the GS registers and the ranges for it.
Reimplemented from RndTex.
|
inlineoverridevirtual |
Release the GS blocks, then the bitmap.
Reimplemented from RndTex.
| void PsTex::Place | ( | ) |
Give each range without blocks its blocks and mark it for upload.
When neither the free list nor another texture can supply a range, every texture is evicted and the free list starts again. The first range is the CLUT when the bitmap has a palette. The name is inferred.
| void PsTex::BuildMoviePacket | ( | bool | bBuild | ) |
Release the movie packet, then build one for the current bitmap when requested.
The packet uploads the bitmap in blocks of 16 by 16 pixels. UploadMovie() copies it into the frame. The name is inferred.
| bBuild | Whether to build a packet. |
| void PsTex::UploadMovie | ( | ) |
Copy the movie packet into the frame, flushing the frame whenever the packet fills it.
The name is inferred.
| void PsTex::UploadImage | ( | int | nDbp, |
| int | nPsm, | ||
| int | nBpp, | ||
| int | nWidth, | ||
| int | nHeight, | ||
| const unsigned char * | pPixels ) |
Add an image transfer of pixels in main memory to the frame.
A null image adds nothing. The texture is not read. The name is inferred.
| nDbp | The destination base pointer in blocks. |
| nPsm | The GS pixel storage mode. |
| nBpp | The bits per pixel. |
| nWidth | The width. |
| nHeight | The height. |
| pPixels | The pixels, or null. |
| void PsTex::Upload | ( | ) |
Place the ranges, upload those marked for upload, and flush the texture cache.
The name is inferred.
| void PsTex::BindAsRenderTarget | ( | ) |
Make the first mipmap the surface the GS draws into.
FRAME_1 addresses the mipmap, XYOFFSET_1 centres it, and a 16-bit texture is dithered.
| void PsTex::SyncRegisters | ( | ) |
Build TEX0, TEX1, and the buffer widths of MIPTBP1 and MIPTBP2, and add a range for the CLUT and for each mipmap.
A rendered texture of fewer than 16 bits per pixel is first made 16 bits. The name is inferred.
| void PsTex::ReleaseSurfaces | ( | ) |
Release the bitmap and the GS blocks, and empty the ranges.
The name is inferred.
| void PsTex::Select | ( | int | nTexFunction | ) |
Upload the texture when needed, then select it on the GS with a texture function.
Each range is stamped with sStamp, and sStamp then advances. A texture without a bitmap selects nothing.
| nTexFunction | The TFX field of TEX0. |
|
static |
Evict every range not selected since the last call, and record the stamp.
The name is inferred.
|
static |
Count the free GS blocks.
The name is inferred.
|
static |
Free every block after the display and depth buffers, and evict every range.
The name is inferred.
|
static |
Return a run of blocks to the free list, merging it with its neighbours.
The name is inferred.
| nStart | The first block. |
| nCount | The number of blocks, or 0 to change nothing. |
|
static |
Report the GS blocks a bitmap occupies, rounded up to the shapes the GS pages allow.
The name is inferred.
| bitmap | The bitmap. |
|
static |
Install the texture factory for the class Tex of a .rnd file, and reset both stamps.
The name is inferred.
|
inlinestatic |
Create a texture.
| pszName | The registry key. |
|
static |
The free runs, in block order.
|
static |
The ranges with blocks, in the order they received them.
|
static |
The count of selections, the stamp Select() records on each range.
|
static |
The value of sStamp at the last BeginFrame().
A range stamped before it is evicted.