why to swizzle? and how works reading...

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
outtony
Posts: 26
Joined: Thu Oct 13, 2005 2:46 am
Location: Slovakia
Contact:

why to swizzle? and how works reading...

Post by outtony »

hello,
could anybody explain why to swizzle textures?

this document explain how to:
http://wiki.pspdev.org/psp:ge_faq

this document explain, that cache consists of 64b chunks. and cache is 8kb like in ps2.
http://goop.org/psp/cache-howto.html

but i dont understand why it's better to rearange texture data THAT way

i understand, that it will have better and not scatter access (so faster), but i want to understand, how the texture in cache is reading and why in that (seems scattered to me) order.
-----------------------------
Tony

www.n3.sk
holger
Posts: 204
Joined: Thu Aug 18, 2005 10:57 am

Post by holger »

that's what is called "swizzling" here is a commonly used technique since 3dfx/voodoo years, there it was called "tiling".

You rearrange the texture data to optimize locality, so that you improve GE texture cache usage (not to confuse with the processor's caches). linear texture filtering and small triangles (the common cases) access very likely texture data of neighboring horizontal pixels and vertical rows of your texture, so it makes sense to keep them close together in memory so that a cache miss will fetch the entire set of soon-to-use data at once.
User avatar
outtony
Posts: 26
Joined: Thu Oct 13, 2005 2:46 am
Location: Slovakia
Contact:

Post by outtony »

holger wrote:that's what is called "swizzling" here is a commonly used technique since 3dfx/voodoo years, there it was called "tiling".

You rearrange the texture data to optimize locality, so that you improve GE texture cache usage (not to confuse with the processor's caches). linear texture filtering and small triangles (the common cases) access very likely texture data of neighboring horizontal pixels and vertical rows of your texture, so it makes sense to keep them close together in memory so that a cache miss will fetch the entire set of soon-to-use data at once.
ahaaa :) now i understand. thanks

so, swizzling is trying to keep the neighbourhood data of texels together in clean lines of cache
-----------------------------
Tony

www.n3.sk
Post Reply