Ninja Library - System Function

njInitVertexBuffer

Allocates the buffers for registration of vertex data

FORMAT

void njInitVertexBuffer( op, om, tp, tm, pt )
Uint32 op
Uint32 om
Uint32 tp
Uint32 tm
Uint32 pt

PARAMETER

 op  Buffer size for non-transparent polygon registration 
 om  Buffer size for non-transparent modifier volume registration 
 tp  Buffer size for translucent polygon registration 
 tm  Buffer size for translucent modifier volume registration 
 pt  Extracted texture registration buffer size 

RETURN

None

DESCRIPTION

Allocates the buffers for registration of vertex data.

Use 3V latency mode with a double buffer. Allocated size of the parameter is *4 bytes.

Further, when one of the parameters is negative, use the 2V latency mode. When using 2V latency mode, use a single buffer, in principle. Buffer that is negative will be transferred immediately to hardware.

The memory for 3V and 2V latency is as follows.

**3V latency

Obtained memory size = (op + om + tp + tm + pt) x 4 + 352 bytes (internal memory)

**2V latency with the same setting as above

Obtained memory size = 100 (negative buffer setting) + (other buffer) x 4 + 352 bytes (internal memory) Example:
In the case of 3V latency
njInitVertexBuffer( 100000, 0, 100000, 0, 0);
op = 100000 x 4 bytes = 400000 bytes
tp = 100000 x 4 bytes = 400000 bytes
internal memory = 352 bytes
Total: 800352 bytes

In the case of 2V latency with the same settings as above
njInitVertexBuffer( -100000, 0, 50000, 0 ,0);
op = minus 100bytes
to = 50000 x 4 bytes = 200000 bytes (as it is a single buffer, the amount is halved)
internal memory = 352 bytes
Total: 200452 bytes


EXAMPLE

The following reserves vertex buffers for non-transparent polygon and translucent polygon 400KB for each.
njInitVertexBuffer( 100000, 0, 100000, 0 , 0);

NOTE

Secure a semitransparent polygon registration buffer when a debug letter is indicated. At this time, a value is not assigned to the extracted texture registration buffer. This function secures internal memory. In order to be called multiple times, the previously secured buffer needs to be released and then secured again.

The value indicated in Nindows is the buffer size divided by 2.

**Error callback variable In the case of system error, error information is returned in _nj_fatal_err_callback_variable.

Library has been changed not to stall system when return value is NJD_FATAL_ERR_OVERFLW_VTXBUF. (There are chances that program stops because buffer overflowed and gets into consecutive area.)

 NJD_FATAL_ERR_NOQEUE_INTR  Not enough memory in QUEUE when tried to activate DMA from inturrupt handler 
 NJD_FATAL_ERR_OVERFLW_VTXBUF  Number of registered vertex overflows buffer 
 NJD_FATAL_ERR_TOO_MANY_VTX  NativeBuffer is essentially insufficient (Registered ISP/TSP buffer is bigger than allocated NativeBuffer) 
 NJD_FATAL_ERR_V_NOT_RESPOND  Sequence gets stuck in VSYNC wait 


njInitVertexBuffer
COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999