Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

PlayStation 2 Texture Cache
[Platform Specific]


Typedefs

typedef void(*  SkyCacheCallBack )(RwRaster *ras, RwBool spec)
typedef void(*  SkyCacheReleaseCallBack )(RwRaster *ras)

Functions

void  RpSkyTexCacheAccessSpeculate (RwRaster *raster)
RwBool  RpSkyTexCacheAccessRaster (RwRaster *raster, RwBool useContext2)
void  RpSkyTexCacheReleaseRaster (RwRaster *raster)
RwBool  RpSkyTexCacheRasterLock (RwRaster *raster, RwBool lock)
void  RpSkyTexCacheRasterUnlockAll (void)
void  RpSkyTexCacheFlush (void)
void  RpSkyTexCacheRestore (void)
RwBool  RpSkyTexCacheDisable (RwBool disable)
RwUInt32  RpSkyTexGetStartAddress (void)
RwUInt32  RpSkyTexGetSize (void)
RwBool  RpSkyTexCacheSetReleaseCallBack (SkyCacheReleaseCallBack fpCacheCB)
SkyCacheReleaseCallBack  RpSkyTexCacheGetReleaseCallBack (void)
RwBool  RpSkyTexCacheSetCallBack (SkyCacheCallBack fpCacheCB)
SkyCacheCallBack  RpSkyTexCacheGetCallBack (void)
RwUInt32  RpSkyTexCacheRasterGetAddr (RwRaster *raster)
RwRaster RpSkyTexSetTex0 (RwRaster *raster, RwUInt32 msb, RwUInt32 lsb)
RwRaster RpSkyTexGetTex0 (RwRaster *raster, RwUInt32 *msb, RwUInt32 *lsb)
RwRaster RpSkyTexCalcTex1 (RwRaster *raster, RwUInt64 *tex1, RwTextureFilterMode filter)
RwRaster RpSkyTexSetMiptbp1 (RwRaster *raster, RwUInt32 msb, RwUInt32 lsb)
RwRaster RpSkyTexGetMiptbp1 (RwRaster *raster, RwUInt32 *msb, RwUInt32 *lsb)
RwRaster RpSkyTexSetMiptbp12 (RwRaster *raster, RwUInt32 msb1, RwUInt32 lsb1, RwUInt32 msb2, RwUInt32 lsb2)
RwRaster RpSkyTexGetMiptbp12 (RwRaster *raster, RwUInt32 *msb1, RwUInt32 *lsb1, RwUInt32 *msb2, RwUInt32 *lsb2)
RwRaster RpSkyTexCacheValidateRaster (RwRaster *raster, RwBool valid)
RwBool  RpSkyUploadPixelData (RwUInt32 pixelWidth, RwUInt32 pixelHeight, RwUInt8 *srcAddress, RwUInt32 dstAddress, RwUInt32 dstWidthBy64, RwUInt32 bitsPerPixel, RwUInt32 pixelFormat, RwUInt32 srcStride)
RwRaster RpSkyTexCacheUploadRaster (RwRaster *raster, RwUInt32 dstAddress)
RwInt32  RpSkyTexCacheGetStartAddress (void)
RwBool  RpSkyTexCacheSetStartAddress (RwInt32 start)

Detailed Description

PlayStation 2 Texture Cache

PlayStation 2 Texture Cache Overview

The PlayStation 2 texture cache provides the functions used to upload textures to GS memory and set up the texture registers on the GS.

It implements both a default behavior and an overload API so that in applications where a specific texture access pattern can be guaranteed, the default behavior can be replaced with a custom cache.


Typedef Documentation

typedef void(* SkyCacheCallBack)(RwRaster *ras, RwBool spec)
 

SkyCacheCallBack

Parameters:
ras  The raster to be uploaded
spec  The upload is speculative
typedef void(* SkyCacheReleaseCallBack)(RwRaster *ras)
 

SkyCacheReleaseCallBack

Parameters:
ras  The raster to release

Function Documentation

RwBool RpSkyTexCacheAccessRaster RwRaster   raster,
RwBool    useContext2
 

RpSkyTexCacheAccessRaster uploads the raster to the GS (if required) and sets up the GS state to use it for texturing. This function can fail if the raster is too big to fit into cache. This may be because too many textures are locked into cache. This function will not evict textures from cache.

Parameters:
raster  a pointer to the RwRaster to upload to the GS
useContext2  an RwBool equal to TRUE if this is a context 2 access
Returns:
TRUE on success or FALSE if there is an error
void RpSkyTexCacheAccessSpeculate RwRaster   raster
 

RpSkyTexCacheAccessSpeculate attempts an asynscronous upload of the raster. This fails silently as it is not a fail to fail, so to speak. Even if it does upload the raster, it doesn't dispatch any state to the GS.

Parameters:
raster  a pointer to the RwRaster
RwBool RpSkyTexCacheDisable RwBool    disable
 

RpSkyTexCacheDisable disables the texture cache. Must be called before RwEngineStart().

Parameters:
disable  an RwBool, TRUE to disable the cache, FALSE to enable it
Returns:
TRUE on success or FALSE if there is an error
void RpSkyTexCacheFlush void   
 

RpSkyTexCacheFlush immediately flushes the cache. It does not remove locked rasters from memory.

SkyCacheCallBack RpSkyTexCacheGetCallBack void   
 

RpSkyTexCacheGetCallBack gets the callback invoked when a raster must be uploaded.

Returns:
The current upload callback
SkyCacheReleaseCallBack RpSkyTexCacheGetReleaseCallBack void   
 

RpSkyTexCacheGetReleaseCallBack gets the callback invoked when a raster must be released. The callback will only be used when the cache is disabled. It may be NULL.

Returns:
The current release callback
RwInt32 RpSkyTexCacheGetStartAddress void   
 

RpSkyTexCacheGetStartAddress

Get the current (word) start address of the texture cache

Returns:
An RwInt32 address of the start address of the cache, or -1 if the cache is not started
RwUInt32 RpSkyTexCacheRasterGetAddr RwRaster   raster
 

RpSkyTexCacheRasterGetAddr gets the current address in GS memory of a particular raster. This is not zero'd when a raster is ejected from cache.

Parameters:
raster  a pointer to the RwRaster
Returns:
an RwUInt32 equal to the GS memory address of the raster
RwBool RpSkyTexCacheRasterLock RwRaster   raster,
RwBool    lock
 

RpSkyTexCacheRasterLock locks or unlocks a raster in cache. This locks the raster in GS memory. It attempts to pack the locked rasters at the top end on memory to avoid fragmentation, but locking several rasters then unlocking all bar the last locked, will not release the space, until the last one is finally unlocked.

Parameters:
raster  a pointer to the RwRaster to lock
lock  an RwBool set to TRUE if the RwRaster is to be locked or to FALSE if it is to be unlocked
Returns:
TRUE on success or FALSE if there is an error
void RpSkyTexCacheRasterUnlockAll void   
 

RpSkyTexCacheRasterUnlockAll unlocks all rasters that have been locked into the cache and expels them.

void RpSkyTexCacheReleaseRaster RwRaster   raster
 

RpSkyTexCacheReleaseRaster removes the raster from cache. This does not check the reference count on the object, so this should be done from the parent if required.

Parameters:
raster  the RwRaster to be removed from the cache
void RpSkyTexCacheRestore void   
 

RpSkyTexCacheRestore restores the current texture context. This is required as the FSAA modes which use blit destroy the GS texture registers. Note that this does not reupload any data. It assumes that content of the cache is unchanged.

RwBool RpSkyTexCacheSetCallBack SkyCacheCallBack    fpCacheCB
 

RpSkyTexCacheSetCallBack specifies the callback invoked when a raster must be uploaded. Note that the callback's signature has changed since RW 3.10.

Parameters:
fpCacheCB  a SkyCacheCallBack , the callback to invoke
Returns:
TRUE on success; FALSE if there is an error
RwBool RpSkyTexCacheSetReleaseCallBack SkyCacheReleaseCallBack    fpCacheCB
 

RpSkyTexCacheSetReleaseCallBack specifies the callback invoked when a raster must be released. The callback will only be used when the cache is disabled. It may be NULL.

Parameters:
fpCacheCB  a SkyCacheReleaseCallBack , the callback to invoke
Returns:
TRUE on success; FALSE if there is an error
RwBool RpSkyTexCacheSetStartAddress RwInt32    start
 

RpSkyTexCacheSetStartAddress sets the start address of the texture cache to be a new value. This value must be >= the value that the texture cache was opened with and must < the value of the lowest locked texture or the top of the texture memory. This function causes the cache to be flushed.

The start address will be rounded to 2K words.

Parameters:
start  the address in GS words. (RwInt32 for conistency)
Returns:
TRUE on success or FALSE if "start" is out of range or Tex Cache is not enabled
RwRaster* RpSkyTexCacheUploadRaster RwRaster   raster,
RwUInt32    dstAddress
 

RpSkyTexCacheUploadRaster uploads an entire raster and all its miplevels and palette to the address specified. This will be faster than calling RpSkyUploadPixelData() on several mip levels and will take advantage of inlined dma data, if present, in the raster. It will update the tex0 extension field.

Parameters:
raster  a pointer to the RwRaster
dstAddress  an RwUInt32 equal to the GS memory word address
Returns:
the raster on success or NULL if there is an error
RwRaster* RpSkyTexCacheValidateRaster RwRaster   raster,
RwBool    valid
 

RpSkyTexCacheValidateRaster marks the raster as in cache or not in cache. The upload callback will be called when the raster is required if it has not been marked as in cache.

Parameters:
raster  a pointer to the RwRaster
valid  an RwBool equal to TRUE is the raster is uploaded or FALSE if it is not
Returns:
a pointer to the RwRaster on success or NULL if there is an error
RwRaster* RpSkyTexCalcTex1 RwRaster   raster,
RwUInt64   tex1,
RwTextureFilterMode    filter
 

RpSkyTexCalcTex1 gets the contents of the mipmap raster extenstion fields on a raster and calculates the TEX1 register value required for these settings and the filter mode.

Parameters:
raster  a pointer to the RwRaster
tex1  pointer to RwUInt64 to receive the TEX1 register value
filter  the filter mode
Returns:
a pointer to the RwRaster
RwRaster* RpSkyTexGetMiptbp1 RwRaster   raster,
RwUInt32   msb,
RwUInt32   lsb
 

RpSkyTexGetMiptbp1 gets the contents of the miptbp1 raster extension fields on a raster

Parameters:
raster  a pointer to receive the most significant 32 bits of miptbp1
msb  a pointer to receive the most significant 32 bits of miptbp1
lsb  a pointer to receive the least significant 32 bits of miptbp1
Returns:
a pointer to the RwRaster
RwRaster* RpSkyTexGetMiptbp12 RwRaster   raster,
RwUInt32   msb1,
RwUInt32   lsb1,
RwUInt32   msb2,
RwUInt32   lsb2
 

RpSkyTexGetMiptbp12 gets the contents of the miptbp1 and miptbp2 extension fields on a raster

Parameters:
raster  a pointer to the RwRaster
msb1  a pointer to an RwUInt32, the address to receive the most significant 32 bits of miptbp1
lsb1  a pointer to an RwUInt32, the address to receive the least significant 32 bits of miptbp1
msb2  a pointer to an RwUInt32 the address to receive the most significant 32 bits of miptbp2
lsb2  a pointer to an RwUInt32 the address to receive the least signficant 32 bits of miptbp2
Returns:
a pointer to the RwRaster
RwUInt32 RpSkyTexGetSize void   
 

RpSkyTexGetSize gets the size of the texture cache in words

Returns:
an RwUInt32 equal to the size in words, or -1 if the cache has not been started yet.
RwUInt32 RpSkyTexGetStartAddress void   
 

RpSkyTexGetStartAddress gets the start word address of the texture cache

Returns:
an RwUInt32 the start address in words, or -1 if the cache has not been started
RwRaster* RpSkyTexGetTex0 RwRaster   raster,
RwUInt32   msb,
RwUInt32   lsb
 

RpSkyTexGetTex0 gets the contents of the tex0 raster extension fields on a raster

Parameters:
raster  a pointer to the RwRaster
msb  a pointer to the RwUInt32 to receive the most significant 32 bits of tex0
lsb  a pointer to the RwUInt32 to receive the least significant 32 bits of tex0
Returns:
a pointer to the RwRaster
RwRaster* RpSkyTexSetMiptbp1 RwRaster   raster,
RwUInt32    msb,
RwUInt32    lsb
 

RpSkyTexSetMiptbp1 sets the value of miptbp1 in the raster extension on the raster. This will be set in the GS registers when the main library uses this raster as a texture

Parameters:
raster  a pointer to the RwRaster
msb  an RwUInt32 equal to the most significant 32 bits of miptbp1
lsb  an RwUInt32 equal to the least significant 32 bits of miptbp1
Returns:
a pointer to the RwRaster
RwRaster* RpSkyTexSetMiptbp12 RwRaster   raster,
RwUInt32    msb1,
RwUInt32    lsb1,
RwUInt32    msb2,
RwUInt32    lsb2
 

RpSkyTexSetMiptbp12 sets the value of miptbp1 and miptbp2 in the extension on the raster. This will be set in the GS registers when the main library uses this raster as a texture

Parameters:
raster  a pointer to an RwRaster
msb1  an RwUInt32, the most significant 32 bits of miptbp1
lsb1  an RwUInt32, the least significant 32 bits of miptbp1
msb2  an RwUInt32, the most significant 32 bits of miptbp2
lsb2  an RwUInt32, the least significant 32 bits of miptbp2
Returns:
a pointer to the RwRaster
RwRaster* RpSkyTexSetTex0 RwRaster   raster,
RwUInt32    msb,
RwUInt32    lsb
 

RpSkyTexSetTex0 sets the value of tex0 in the raster extension on the raster. This will be set in the GS registers when the main library uses this raster as a texture

Parameters:
raster  a pointer to an RwRaster
msb  an RwUInt32 equal to the most significant 32 bits of tex0
lsb  an RwUInt32 equal to the least significant 32 bits of tex0
Returns:
a pointer to the RwRaster
RwBool RpSkyUploadPixelData RwUInt32    pixelWidth,
RwUInt32    pixelHeight,
RwUInt8   srcAddress,
RwUInt32    dstAddress,
RwUInt32    dstWidthBy64,
RwUInt32    bitsPerPixel,
RwUInt32    pixelFormat,
RwUInt32    srcStride
 

RpSkyUploadPixelData uploads some pixel data to GS memory. The pixels must be flushed from DCache. Additionally the start address must be quad word aligned, and in the case where the data cannot be uploaded in a single dma transfer, each restart point must be quad word aligned (For example, if the stride is not equal to the pixel depth*width, each scan line must be aligned)

Parameters:
pixelWidth  an RwUInt32 equal to the width in pixels
pixelHeight  an RwUInt32 equal to the height in pixels
srcAddress  a pointer to an RwUInt8 equal to the source adddress
dstAddress  an RwUInt32 equal to the GS memory destination address in words
dstWidthBy64  an RwUInt32 equal to the destination buffer width in pixels/64
bitsPerPixel  an RwUInt32 equal to the number of bits per pixel
pixelFormat  an RwUInt32 that represents the pixel format
srcStride  an RwUInt32 equal to the stride of the source data
Returns:
TRUE

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:46:24 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)