#include <revolution/gd.h> void GDSetTexImgPtr ( GXTexMapID id, void *image_ptr ); void GDSetTexImgPtrRaw ( GXTexMapID id, u32 image_ptr_raw ); void GDPatchTexImgPtr ( void *image_ptr );
| id | The hardware texture map ID to change. |
|---|---|
image_ptr |
A pointer to the texture data in Wii main memory. This pointer will be converted from a cached to a physical pointer. |
image_ptr_raw |
A U24 value to be inserted in place of actual base pointer, image_ptr. This value will be inserted unchanged into the command output. |
None.
GDSetTexImgPtr function is used to set the image pointer for a specified hardware texture map ID. Unlike the GX library, which uses texture objects, GD libraries set the hardware registers directly.
GDSetTexImgPtr function takes a Wii main memory pointer as an argument. This function is used for writes to the display list. Because the desired address is unknown when the display list is created, additional functions are available to simplify patching the display list.
The GDSetTexImgPtrRaw function allows a raw (U24) data value to be written in place of the texture data pointer. The GDSetTexImgPtr function converts the logical address into a physical address. The raw version of the function omits this process.
GDPatchTexImgPtr function writes out a converted address only. To properly use this function, you must first save the correct patch location (when the display list was created), and then reset the current offset to this patch location before calling GDPatchTexImgPtr. Finally, the newly written data is flushed back into main memory. The following code illustrates the correct operation sequence.
Display list creation:
savedOffset[0] = GDGetCurrOffset() + BP_DATA_OFFSET; // save the necessary offset GDSetTexImgPtrRaw( GX_TEXMAP0, 0 );
Display list patching:
GDSetCurrOffset(savedOffset[0]); // set the offset cp = GDGetCurrPointer(); // save ptr for flushing later GDPatchTexImgPtr(tp); // patch in the base address ptr DCStoreRange(cp, BP_DATA_LENGTH); // flush to main memory
Because the GDSetTexImgPtr function issues a BP command, BP_DATA_OFFSET and BP_DATA_LENGTH are used in the above code segments.
GXInitTexObj, GDSetTexLookupMode, GDSetTexImgAttr
2006/03/01 Initial version.
CONFIDENTIAL