Changes

Jump to navigation Jump to search
+intro paragraph, oslib notes
'''Swizzling''' is a process that reorders the pixels in an image to make it more adapted to the way the graphic processor reads it.
 
Internally, the GE processes textures as 16 bytes by 8 rows blocks (independent of actual pixel format, so a 32×32 32-bit texture is a 128×32 texture from "swizzled" point of view). When a texture is not swizzled, the GE will have to do scattered reads as it moves the block into its texture-cache, which has a performance impact.
To improve read performance, texture pixels can be reordered, or "swizzled," into these blocks so the GE can fetch one entire block by reading sequentially.
== Code Examples (C) ==
Example code to re-order a texture into swizzled format:
}
</syntaxhighlight>
 
== Notes ==
[[OSLib]] automatically swizzles images when loading from a file via <code>oslLoadImageFile</code>, but not images created manually with <code>oslCreateImage</code>. Swizzling can be disabled when loading from file by passing <code>OSL_UNSWIZZLED</code> when loading.

Navigation menu