Changes

Jump to navigation Jump to search
adding VFPU stuff
The GU routines use hardware to perform drawing operations for you. Note that you can draw to different locations, such as a memory buffer or to the framebuffer, in the latter case you'll see the result on screen. This also means it is possible to combine page flipping with hardware assisted drawing, and there's GU routines to help with this. It is important to note that since the GPU is drawing stuff the CPU are free to do other things, also note that you have to consider that the CPU doesn't know what the GPU is doing and vice versa. Because of cache, all textures, vertex lists and such must be in memory before you use them. This means you use a function to invalidate the cache for those memory regions causing any cached data to be written to memory. Again the same data also needs to be in a memory address that is a multiple of 16 bytes, but if you use GU routines to allocate the memory they will take care of this for you. Textures need to be swizzled as well.
 
=== Developing VFPU Code ===
The 128 32-bit VFPU registers are reconfigurable to operate as single values, 2x2/3x3/4x4 rows, columns, matrices, or transposed matrices. The stored matrices can be multiplied in a single operation. The usual selection of trigonometric/square root instructions is available.
 
The VFPU also has an on-board pseudo-random number generator.
 
VFPU code is written in assembly, and the PSP build toolchain supports all known VFPU operations.
 
<syntaxhighlight lang="c">
/∗ Multmatrix $a0−result, $a1−a, $a2−b ∗/
multmatrix :
/∗ Load matrices to internal registers ∗/
ulv.q C000, 0($a1); ulv.q C010, 16($a1)
ulv.q C020, 32($a1); ulv.q C030, 48($a1)
ulv.q C100, 0($a2); ulv.q C110, 16($a2)
ulv.q C120, 32($a2); ulv.q C130, 48($a2)
/∗ Multiply matrices∗/
vmmul.q M200, M000, M100
/∗ Store result */
usv.q C200, 0($a0); usv.q C210, 16($a0)
usv.q C220, 32($a0); usv.q C230, 48($a0)
</syntaxhighlight>
== Tutorials ==

Navigation menu