KallistiOS git master
Independent SDK for the Sega Dreamcast
|
API for managing PowerVR textures More...
Topics | |
Flags | |
Texture loading constants | |
Formats | |
PowerVR texture formats | |
Functions | |
bool | pvr_txr_set_stride (uint32_t texture_width) |
Set the global stride width for non-power-of-two textures in PVR RAM. | |
uint32_t | pvr_txr_get_stride (void) |
Get the current texture stride width in pixels as set in the PVR. | |
void | pvr_txr_load (const void *src, pvr_ptr_t dst, uint32_t count) |
Load raw texture data from an SH-4 buffer into PVR RAM. | |
void | pvr_txr_load_ex (const void *src, pvr_ptr_t dst, uint32_t w, uint32_t h, uint32_t flags) |
Load texture data from an SH-4 buffer into PVR RAM, twiddling it in the process. | |
void | pvr_txr_load_kimg (const kos_img_t *img, pvr_ptr_t dst, uint32_t flags) |
Load a KOS Platform Independent Image (subject to constraint checking). | |
API for managing PowerVR textures
Helper functions for handling texture tasks of various kinds.
uint32_t pvr_txr_get_stride | ( | void | ) |
Get the current texture stride width in pixels as set in the PVR.
This function reads the PVR_TXR_STRIDE_MULT
register and calculates the texture stride width in pixels. The value returned is the width in pixels that has been configured for all textures using the PVR_TXRFMT_X32_STRIDE
flag in the same frame.
The stride width is computed by taking the current multiplier in PVR_TXR_STRIDE_MULT
(which stores the width divided by 32), and multiplying it back by 32 to return the full width in pixels.
void pvr_txr_load | ( | const void * | src, |
pvr_ptr_t | dst, | ||
uint32_t | count ) |
Load raw texture data from an SH-4 buffer into PVR RAM.
This essentially just acts as a memcpy() from main RAM to PVR RAM, using the Store Queues and 64-bit TA bus.
src | The location in main RAM holding the texture. |
dst | The location in PVR RAM to copy to. |
count | The size of the texture in bytes (must be a multiple of 32). |
void pvr_txr_load_ex | ( | const void * | src, |
pvr_ptr_t | dst, | ||
uint32_t | w, | ||
uint32_t | h, | ||
uint32_t | flags ) |
Load texture data from an SH-4 buffer into PVR RAM, twiddling it in the process.
This function loads a texture to the PVR's RAM with the specified set of flags. It will currently always twiddle the data, whether you ask it to or not, and many of the parameters are just plain not supported at all... Pretty much the only supported flag, other than the format ones is the PVR_TXRLOAD_INVERT_Y one.
This will be slower than using pvr_txr_load() in pretty much all cases, so unless you need to twiddle your texture, just use that instead.
src | The location to copy from. |
dst | The location to copy to. |
w | The width of the texture, in pixels. |
h | The height of the texture, in pixels. |
flags | Some set of flags, ORed together. |
Load a KOS Platform Independent Image (subject to constraint checking).
This function loads a KOS Platform Independent image to the PVR's RAM with the specified set of flags. This function, unlike pvr_txr_load_ex() supports everything in the flags available, other than what's explicitly marked as not supported.
img | The image to load. |
dst | The location to copy to. |
flags | Some set of flags, ORed together. |
bool pvr_txr_set_stride | ( | uint32_t | texture_width | ) |
Set the global stride width for non-power-of-two textures in PVR RAM.
This function configures the global texture stride register PVR_TXR_STRIDE_MULT
, which defines the row width in VRAM for non-power-of-two textures. The setting applies to all textures rendered with the PVR_TXRFMT_X32_STRIDE
flag in the same frame. Since PVR_TXR_STRIDE_MULT
is a global register, all textures using this flag must share the same stride width in each frame.
The stride width configured here is only supported for textures with widths that are multiples of 32 pixels and up to a maximum of 992 pixels. Any texture width not meeting this requirement will not work with the PVR_TXRFMT_X32_STRIDE
flag.
PVR_TXRFMT_X32_STRIDE
flag so the stride set here will not apply to them.texture_width | The width of the texture in pixels. Must be a multiple of 32 and up to 992 pixels. |
true | On success. |
false | On failure. |