Make a GX_SetVtxAttrFmtv() with explicit count

Add your suggestions for toolchain improvements here.
Post Reply
figgles
Posts: 5
Joined: Thu Jun 30, 2011 8:40 pm

Make a GX_SetVtxAttrFmtv() with explicit count

Post by figgles » Sat Jul 02, 2011 10:54 am

Right now, GX_SetVtxAttrFmtv() expects a terminating entry in the array to have GX_VA_NULL set. When the exact number of attributes is known, then you must allocate N+1 attributes structs just to set the N+1th one to GX_VA_NULL. Annoying and wastes memory. It would be much nicer if one could just specify the number of attributes, since that is the most common case (knowing how many attributes as opposed to unsure count but just setting the last one to NULL). A sample implementation is given below:

Code: Select all

void GX_SetVtxAttrFmtList(u8 vtxfmt, GXVtxAttrFmt *attr_list, u32 count)
{
    u32 i;	
    for(i=0;i<count;i++) {
        __SETVCDFMT(vtxfmt,attr_list[i].vtxattr,attr_list[i].comptype,attr_list[i].compsize,attr_list[i].frac);
    }
    __gx->VATTable |= (1<<vtxfmt);
    __gx->dirtyState |= 0x0010;
}
The same gripe applies to GX_SetVtxDescv(). If it wasn't for legacy's sake, I'd say that redoing the GX_SetVtx*v() interfaces should be redone to take an explicit count.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests