Functions | |
pgl_slot_handle_t | pglAddGsMemSlot (int startingPage, int pageLength, unsigned int pixelMode) |
Adds a memory slot to the list of free slots. More... | |
void | pglLockGsMemSlot (pgl_slot_handle_t slot_handle) |
Prevents a slot from being allocated or freed automatically. More... | |
void | pglUnlockGsMemSlot (pgl_slot_handle_t slot_handle) |
Lets the memory manager automatically allocate/free a slot that was previously locked. More... | |
void | pglRemoveAllGsMemSlots () |
Removes all gs memory slots. More... |
As mentioned in the documentation for "GS memory management," ps2gl asks the user to partition GS memory into slots. A slot is defined by a starting page number in GS ram, a page length, and a preferred pixel format.
Note that the pixel format of a slot is its preferred format. If there are no slots of the requested pixel type large enough, ps2gl will try to find a big enough slot of a "higher" pixel type. For example, a 64x64, 32-bit slot (2 pages) might be allocated to hold a 128x128, 8-bit image if there were no 8-bit slots large enough.
The idea is that if a level has a lot of 64x64, 8-bit textures, you would allocate a lot of 64x64, 8-bit slots.
For example, say that our app uses a 640x448 interlaced display with a 24-bit depth buffer. We would create 3 slots, one for the depth buffer and two for a double-buffered frame buffer.
First, we need the size and starting address of each slot. The size is calculated from the dimensions of a page for the pixel format in question. Here are the dimensions of one GS "page" for the various pixel formats (from section 8.3 of the GS manual):
Now that we have the sizes of each slot (70 pages), we just need the starting addresses. It doesn't really matter much where they begin, except of course when existing code assumes to find them in certain places. So let's make them contiguous starting at page 0:
pglAddGsMemSlot( 0, 70, SCE_GS_PSMCT32 );
pglAddGsMemSlot( 70, 70, SCE_GS_PSMCT32 );
pglAddGsMemSlot( 140, 70, SCE_GS_PSMZ32 );
Take a look at ps2glut.cpp for a more complete example (a better tutorial is on the way).
|
Adds a memory slot to the list of free slots.
Definition at line 121 of file gsmemory.cpp. |
|
Prevents a slot from being allocated or freed automatically. The slot can still be bound to an area by the user. Definition at line 136 of file gsmemory.cpp. |
|
Removes all gs memory slots.
Definition at line 157 of file gsmemory.cpp. |
|
Lets the memory manager automatically allocate/free a slot that was previously locked.
Definition at line 147 of file gsmemory.cpp. |