1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../css/manpage.css" type="text/css" />
7<title>nngxAddSubroutineCommand</title>
8  </head>
9  <body>
10<h1><CODE>nngxAddSubroutineCommand</CODE> Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14NNGX_APICALL void NNGX_APIENTRY nngxAddSubroutineCommand(
15     const GLvoid * bufferaddr,
16     GLsizei buffersize
17);
18</pre>
19    </div>
20<h2>Arguments</h2>
21    <div class="section">
22      <table class="arguments">
23        <thead>
24          <tr>
25            <td width="15" />
26<th>Name</th>
27<td>Description</td>
28          </tr>
29        </thead>
30        <tr>
31<td>in</td>
32<th><CODE>bufferaddr</CODE></th>
33<td>Address of the region storing the command buffer.</td>
34        </tr>
35        <tr>
36<td>in</td>
37<th><CODE>buffersize</CODE></th>
38<td>Size of the command buffer stored at <CODE>bufferaddr</CODE> in bytes.</td>
39        </tr> </table>
40    </div>
41<h2>Return Values</h2>
42<div class="section">No values are returned. </div>
43<h2>Description</h2>
44    <div class="section">
45<p>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. </p><p>
46When 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 <CODE>bufferaddr</CODE> up to the buffer size given by <CODE>buffersize</CODE>. 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.
47            </p><p>
48Once 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 <CODE>bufferadderss</CODE> without allowing any interrupts. You can execute the rest of the current command buffer without an interrupt after the <CODE>bufferaddr</CODE> region has been executed by storing a kick command (a command  that writes 1 in register <CODE>0x23D</CODE>) on Channel 1 at the end of commands stored in <CODE>bufferaddr</CODE>.
49            </p><p>
50A Channel 1 kick command must be stored at the end of the command buffer specified by <CODE>bufferaddr</CODE>. 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 <CODE>0x239</CODE> and <CODE>0x23B</CODE>) 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.
51            </p><p>
52This 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 <a href="../nn_gx/nngxFlush3DCommand.html">nngxFlush3DCommand</a> and execute.
53            </p><p>
54Also, when using commands generated by this function, the Channel 1 command address (the value set in register <CODE>0x23B</CODE>) represents the address right after the current command buffer. The command size to be executed from that address (the value set in register <CODE>0x239</CODE>) 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.
55            </p><p>
56The command buffer given by <CODE>bufferaddr</CODE> is directly executed from the specified address without being copied to the current command buffer. Applications must guarantee that the buffer given by <CODE>bufferaddr</CODE> is flushed. Furthermore, <CODE>bufferaddr</CODE> must be a multiple of 16.
57            </p><p>
58<CODE>buffersize</CODE> must be a positive multiple of 16.
59            </p><p>
60This function generates the following errors.
61<TABLE><TR><TH>GL_ERROR_809D_DMP</TH><TD><CODE>0</CODE> is bound to the current command list.</TD></TR><TR><TH>GL_ERROR_809E_DMP</TH><TD><SPAN class="argument">buffersize</SPAN> is less than or equal to <CODE>0</CODE>.</TD></TR><TR><TH>GL_ERROR_809F_DMP</TH><TD><SPAN class="argument">bufferaddr</SPAN> is not a multiple of 16.</TD></TR><TR><TH>GL_ERROR_80A0_DMP</TH><TD><SPAN class="argument">bufferaddr</SPAN> is not a multiple of 16.</TD></TR><TR><TH>GL_ERROR_80A1_DMP</TH><TD>The maximum storage size for the command buffer of the current command list was exceeded when a command was added using this function.</TD></TR></TABLE></p></div>
62<h2>See Also</h2>
63    <div class="section">
64<p class="reference"><a href="../nn_gx/nngxAddJumpCommand.html"><CODE>nngxAddJumpCommand</CODE></a><br /> </p>
65    </div>
66<h2>Revision History</h2>
67    <div class="section">
68      <dl class="history">
69        <dt>2011/10/04</dt>
70<dd>Added <B>See Also</B> section.<br />
71        </dd>
72        <dt>2011/07/28</dt>
73<dd>Initial version.<br />
74        </dd>
75      </dl>
76    </div>
77  <hr><p>CONFIDENTIAL</p></body>
78</html>