Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

GS memory 'areas'

API for working with GS memory "areas" that are used to allocate GS ram. More...

Functions

pgl_area_handle_t pglCreateGsMemArea (int width, int height, unsigned int pix_format)
 Create a memory area.

void pglDestroyGsMemArea (pgl_area_handle_t mem_area)
 Destroy a memory area (free the memory it occupies).

void pglAllocGsMemArea (pgl_area_handle_t mem_area)
 Allocate GS ram by binding to a slot.

void pglFreeGsMemArea (pgl_area_handle_t mem_area)
 Free a memory area.

void pglSetGsMemAreaWordAddr (pgl_area_handle_t mem_area, unsigned int addr)
 Manually set the starting GS ram word address of this area (mainly for compatibility with existing code).

void pglBindGsMemAreaToSlot (pgl_area_handle_t mem_area, pgl_slot_handle_t mem_slot)
 This is the manual equivalent of pglAllocGsMemArea() (except that the slot does not have to be unlocked).

void pglUnbindGsMemArea (pgl_area_handle_t mem_area)
 Release the slot bound to this area.

void pglLockGsMemArea (pgl_area_handle_t mem_area)
 Prevent this area from being allocated or freed automatically by the memory manager (it may still be operated on manually).

void pglUnlockGsMemArea (pgl_area_handle_t mem_area)
 Let the memory manager affect the allocation of this area.

int pglGsMemAreaIsAllocated (pgl_area_handle_t mem_area)
unsigned int pglGetGsMemAreaWordAddr (pgl_area_handle_t mem_area)

Detailed Description

API for working with GS memory "areas" that are used to allocate GS ram.

An area is defined by a width and height (in pixels) and a pixel format. The area can then be given an address in GS ram by the application or be bound to a memory slot (either automatically or by the user) which will set the address in GS ram.

An allocated memory area (one that has an address) can be used as a texture, drawn to, or displayed.


Function Documentation

void pglAllocGsMemArea ( pgl_area_handle_t mem_area )
 

Allocate GS ram by binding to a slot.

This operation will first find a list of slots which are closest in dimension and pixel format to the memory area in question, then bind either to a free slot or, if none are available, to the least-recently-used slot after first freeing it.

Note that this will always succeed. If no suitable, unlocked slots exist the memory manager will panic and fail an assertion.

Definition at line 216 of file gsmemory.cpp.

void pglBindGsMemAreaToSlot ( pgl_area_handle_t mem_area,
pgl_slot_handle_t mem_slot )
 

This is the manual equivalent of pglAllocGsMemArea() (except that the slot does not have to be unlocked).

Definition at line 250 of file gsmemory.cpp.

pgl_area_handle_t pglCreateGsMemArea ( int width,
int height,
unsigned int pix_format )
 

Create a memory area.

Parameters:
width   width in pixels
height   height in pixels
pix_format   pixel format (SCE_GS_PS*)
Returns:
a handle to the newly created area

Definition at line 189 of file gsmemory.cpp.

void pglDestroyGsMemArea ( pgl_area_handle_t mem_area )
 

Destroy a memory area (free the memory it occupies).

Definition at line 199 of file gsmemory.cpp.

void pglFreeGsMemArea ( pgl_area_handle_t mem_area )
 

Free a memory area.

Note that this does not free any main ram; the user must still call pglDestroyGsMemArea();

Definition at line 227 of file gsmemory.cpp.

unsigned int pglGetGsMemAreaWordAddr ( pgl_area_handle_t mem_area )
 

Returns:
the starting word address in GS ram of this area

Definition at line 298 of file gsmemory.cpp.

int pglGsMemAreaIsAllocated ( pgl_area_handle_t mem_area )
 

Returns:
1 if allocated, 0 if not.

Definition at line 289 of file gsmemory.cpp.

void pglLockGsMemArea ( pgl_area_handle_t mem_area )
 

Prevent this area from being allocated or freed automatically by the memory manager (it may still be operated on manually).

Definition at line 271 of file gsmemory.cpp.

void pglSetGsMemAreaWordAddr ( pgl_area_handle_t mem_area,
unsigned int addr )
 

Manually set the starting GS ram word address of this area (mainly for compatibility with existing code).

Parameters:
addr   the word address in GS ram (byte addr / 4)

Definition at line 239 of file gsmemory.cpp.

void pglUnbindGsMemArea ( pgl_area_handle_t mem_area )
 

Release the slot bound to this area.

Definition at line 260 of file gsmemory.cpp.

void pglUnlockGsMemArea ( pgl_area_handle_t mem_area )
 

Let the memory manager affect the allocation of this area.

Definition at line 280 of file gsmemory.cpp.


ps2gl version 0.2