nngxAddSubroutineCommand Function

Syntax

NNGX_APICALL void NNGX_APIENTRY nngxAddSubroutineCommand(
     const GLvoid * bufferaddr,
     GLsizei buffersize
);

Parameters

Name Description
in bufferaddr Address of the region storing the command buffer.
in buffersize Size of the command buffer stored at bufferaddr in bytes.

Return Values

No values are returned.

Description

Adds the following commands to the current command buffer: a command that sets the execution address to the specified command buffer; and a command that sets address information so that execution can return to the command buffer that was jumped from.

When this function is called, Channel 0 of the command buffer execution interface is used to add a command to the current command buffer for executing the command buffer from bufferaddr up to the buffer size given by buffersize. In addition, on Channel 1 of the command buffer execution interface, this function adds a command to the current command buffer for configuring the return address, which is the address that follows current command buffer.

Once the current command buffer is executed, commands that have accumulated up to the point this function is called will execute first and then subsequent execution will start from the address specified by bufferadderss without allowing any interrupts. You can execute the rest of the current command buffer without an interrupt after the bufferaddr region has been executed by storing a kick command (a command that writes 1 in register 0x23D) on Channel 1 at the end of commands stored in bufferaddr.

A Channel 1 kick command must be stored at the end of the command buffer specified by bufferaddr. Although you can also store the kick command of another command buffer instead of a Channel 1 kick command, you must kick the command using Channel 0 in that case, making it necessary to store a Channel 1 kick command at the end of the command buffer to be ultimately kicked. The command size and address (registers 0x239 and 0x23B) for Channel 1 must not be overwritten during this period. The kick command for the next command buffer and location of the final Channel 1 kick command must be handled by the application.

This function does not accumulate command requests for render commands. Even after this function is called, subsequent commands will accumulate. Be sure to flush the cache using nngxFlush3DCommand and execute.

Also, when using commands generated by this function, the Channel 1 command address (the value set in register 0x23B) represents the address right after the current command buffer. The command size to be executed from that address (the value set in register 0x239) is not yet known when this function is called, but will be determined later when the command buffer is flushed. Operations are undefined if command buffer content is copied and used between the point this function is called and the point the current command buffer is flushed.

The command buffer given by bufferaddr is directly executed from the specified address without being copied to the current command buffer. Applications must guarantee that the buffer given by bufferaddr is flushed. Furthermore, bufferaddr must be a multiple of 16.

buffersize must be a positive multiple of 16.

This function generates the following errors.

GL_ERROR_809D_DMP0 is bound to the current command list.
GL_ERROR_809E_DMPbuffersize is less than or equal to 0.
GL_ERROR_809F_DMPbufferaddr is not a multiple of 16.
GL_ERROR_80A0_DMPbufferaddr is not a multiple of 16.
GL_ERROR_80A1_DMPThe maximum storage size for the command buffer of the current command list was exceeded when a command was added using this function.

See Also

nngxAddJumpCommand

Revision History

2011/10/04
Added See Also section.
2011/07/28
Initial version.

CONFIDENTIAL