Loading texture GU

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
siberianstar
Posts: 70
Joined: Thu Jun 22, 2006 9:24 pm

Loading texture GU

Post by siberianstar »

Hello,

I'm reading that texture data must be aligned to 16bytes, what means ?

Code: Select all

/**
  * Set current texturemap
  *
  * Textures may reside in main RAM, but it has a huge speed-penalty. Swizzle textures
  * to get maximum speed.
  *
  * @note Data must be aligned to 1 quad word (16 bytes)
  *
  * @param mipmap - Mipmap level
  * @param width - Width of texture (must be a power of 2)
  * @param height - Height of texture (must be a power of 2)
  * @param tbw - Texture Buffer Width (block-aligned)
  * @param tbp - Texture buffer pointer (16 byte aligned)
**/
void sceGuTexImage(int mipmap, int width, int height, int tbw, const void* tbp);
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

It means you have to allocate your memory aligned to 16 bytes.

Do this,

void * _buf = memalign(16,TexWidth*TexHeight*3);

or similar. 16 = how many bytes to align it to.

If you need for a non dynamic allocation, use atrribute align 16
Post Reply