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>nngxValidateState</title> 8 </head> 9 <body> 10<h1><CODE>nngxValidateState</CODE> Function</h1> 11<h2>Syntax</h2> 12 <div class="section"> 13 <pre class="definition"> 14NNGX_APICALL void NNGX_APIENTRY nngxValidateState( 15 GLbitfield statemask, 16 GLboolean drawelements 17); 18</pre> 19 </div> 20<h2>Parameters</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>statemask</th> 33<td>State flag to check (specified as a bitwise OR).</td> 34 </tr> 35 <tr> 36<td>in</td> 37<th>drawelements</th> 38<td>Function that performs actual rendering (either <CODE>glDrawElements</CODE> or <CODE>glDrawArrays</CODE>).</td> 39 </tr> </table> 40 </div> 41<h2>Return Values</h2> 42<div class="section">There is no return value. </div> 43<h2>Description</h2> 44 <div class="section"> 45<p>Checks the state and generates commands.</p><P> 46Checks the DMPGL state and generates commands. Commands are normally accumulated in the 3D command buffer when certain DMPGL 2.0 functions are called. Most of these commands are generated by the <CODE><a href="../gl/glDrawElements.html">glDrawElements</a></CODE> and <CODE><a href="../gl/glDrawArrays.html">glDrawArrays</a></CODE> functions. DMPGL functions check the state and, if it is updated, generate the relevant commands. This is called validation. With the <CODE><a href="../gl/glDrawElements.html">glDrawElements</a></CODE> and <CODE><a href="../gl/glDrawArrays.html">glDrawArrays</a></CODE> functions, most of the states are all validated at once. With this function, on the other hand, you can validate certain combinations of states. 47 </P><P> 48Set <SPAN class="argument">statemask</SPAN> to a bitwise OR of the state flags to validate. Set <SPAN class="argument">drawelements</SPAN> to <CODE>GL_TRUE</CODE> when <a href="../gl/glDrawElements.html"><CODE>glDrawElements</CODE></a> is called and to <CODE>GL_FALSE</CODE> when <CODE><a href="../gl/glDrawArrays.html">glDrawArrays</a></CODE> is called for actual rendering. To validate certain states, it is sometimes necessary to know whether <CODE><a href="../gl/glDrawElements.html">glDrawElements</a></CODE> or <CODE><a href="../gl/glDrawArrays.html">glDrawArrays</a></CODE> is used for rendering. 49 </P><P> 50You can input the following values in <SPAN class="argument">statemask</SPAN>. 51<TABLE><TR><TH><CODE>NN_GX_STATE_SHADERBINARY</CODE></TH><TD>The shader binary state. Commands are generated for loading shader assembler code. This state is updated when the program is switched by a call to <CODE>glUseProgram</CODE> and each of the shader objects linked to the program object at the time of the switch are the ones loaded by individual calls to <CODE>glShaderBinary</CODE>. 52</TD></TR><TR><TH><CODE>NN_GX_STATE_SHADERPROGRAM</CODE></TH><TD>The shader program state. Commands are generated for configuring structure of vertex attributes, among other things. This state is updated when the program object is switched by a call to <CODE>glUseProgram</CODE>. Commands are generated only for registers where settings have been changed. When validating this state, the system compares against the settings when last validated, and generates commands only for those settings that are different. 53</TD></TR><TR><TH><CODE>NN_GX_STATE_SHADERMODE</CODE></TH><TD>The shader mode state. Commands are generated for toggling whether to use the geometry shader. This state is updated when switching between using and not using the geometry shader by a call to <CODE>glUseProgram</CODE>. 54</TD></TR><TR><TH><CODE>NN_GX_STATE_SHADERFLOAT</CODE></TH><TD>The shader floating-point state. Commands are generated for setting the floating-point registers for which values are defined by <CODE>def</CODE> commands in the shader assembler. This state is updated when the program object is switched to a program object for which different shader object is attached by a call to <CODE>glUseProgram</CODE>. 55</TD></TR><TR><TH><CODE>NN_GX_STATE_VSUNIFORM</CODE></TH><TD>The vertex shader uniform state. Commands are generated for setting the floating-point, boolean, and integer registers that are defined as uniforms in the shader assembler. This state is updated when the program object is switched by a call to <CODE>glUseProgram</CODE>, or when the vertex shader uniform values are set by a call to <CODE>glUniform</CODE>. The floating-point register uniform state is updated even when the setting is not changed. The integer register uniform state is not updated unless the setting is changed. 56</TD></TR><TR><TH><CODE>NN_GX_STATE_FSUNIFORM</CODE></TH><TD>The reserved fragment shader uniform state. Commands are generated to set the registers for the reserved fragment shader uniform. This state is updated when the uniform's values are changed, either when a program object is switched by a call to <CODE>glUseProgram</CODE>, or when the uniform values are changed in the fragment shader uniform setting by a call to <CODE>glUniform</CODE>. 57</TD></TR><TR><TH><CODE>NN_GX_STATE_LUT</CODE></TH><TD>The lookup table state. Commands are generated to set the lookup table. This state is updated when the contents are changed of the lookup table bound by calls to <CODE>glBindTexture</CODE>, <CODE>glTexImage1D</CODE>, or <CODE>glTexSubImage1D</CODE>; when the bound lookup table object is deleted by a call to <CODE>glDeleteTextures</CODE>; or when the lookup table objects specified by the lookup table ID setting uniforms are changed by calls to <CODE>glUseProgram</CODE> or <CODE>glUniform</CODE>. 58</TD></TR><TR><TH><CODE>NN_GX_STATE_TEXTURE</CODE></TH><TD>The texture state. Commands are generated for the texture unit. This excludes procedural textures. This state is updated when <CODE>glBindTexture</CODE>, <CODE>glTexImage2D</CODE>, <CODE>glCompressedTexImage2D</CODE>, <CODE>glCopyTexImage2D</CODE>, <CODE>glCopyTexSubImage2D</CODE>, or <CODE>glTexParameter</CODE> are called; when the texture object in use is deleted by a call to <CODE>glDeleteTextures</CODE>; or when the reserved fragment shader uniform <CODE>dmp_Texture[i].samplerType</CODE> is changed by a call to <CODE>glUseProgram</CODE> or <CODE>glUniform</CODE>. 59</TD></TR><TR><TH><CODE>NN_GX_STATE_FRAMEBUFFER</CODE></TH><TD>The framebuffer buffer data state. Commands are generated for the framebuffer format and buffer address. This state is updated when <CODE>glBindFramebuffer</CODE>, <CODE>glBindFramebufferRenderbuffer</CODE>, <CODE>glFramebufferTexture2D</CODE>, <CODE>glDeleteFramebuffers</CODE>, <CODE>glBindRenderbuffer</CODE>, <CODE>glRenderbufferStorage</CODE>, or <CODE>glDeleteRenderbuffers</CODE> are called. 60</TD></TR><TR><TH><CODE>NN_GX_STATE_VERTEX</CODE></TH><TD>The vertex attribute data state. Commands are generated for the vertex attribute data. This state is updated when <CODE>glBindBuffer</CODE>, <CODE>glBufferData</CODE>, <CODE>glBufferSubData</CODE>, <CODE>glEnableVertexAttribArray</CODE>, <CODE>glDisableVertexAttribArray</CODE>, <CODE>glVertexAttribPointer</CODE>, <CODE>glVertexAttrib</CODE>, or <CODE>glUseProgram</CODE> are called; or when the current vertex buffer is deleted by a call to <CODE>glDeleteBuffers</CODE>. 61</TD></TR><TR><TH><CODE>NN_GX_STATE_TRIOFFSET</CODE></TH><TD>The polygon offset state. Commands are generated for the polygon offset. This state is updated when the <CODE>GL_POLYGON_OFFSET_FILL</CODE> setting is changed by calls to <CODE>glEnable</CODE> or <CODE>glDisable</CODE>; when settings are changed by calls to <CODE>glDepthRangef</CODE> or <CODE>glPolygonOffset</CODE>; or when <CODE>glUseProgram</CODE> is called. 62</TD></TR><TR><TH><CODE>NN_GX_STATE_FBACCESS</CODE></TH><TD>The framebuffer access method state. Commands are generated for the framebuffer read/write and other access method. This state is updated when the <CODE>GL_COLOR_LOGIC_OP</CODE>, <CODE>GL_BLEND</CODE>, <CODE>GL_DEPTH_TEST</CODE>, <CODE>GL_EARLY_DEPTH_TEST_DMP</CODE>, or <CODE>GL_STENCIL_TEST</CODE> settings are changed by calls to <CODE>glEnable</CODE> or <CODE>glDisable</CODE>; when settings are changed by calls to <CODE>glDepthFunc</CODE>, <CODE>glEarlyDepthFuncDMP</CODE>, <CODE>glColorMask</CODE>, <CODE>glDepthMask</CODE>, or <CODE>glStencilMask</CODE>; or when reserved fragment shader uniform <CODE>dmp_FragOperation.mode</CODE> is set by a call to <CODE>glUniform</CODE>. 63</TD></TR><TR><TH><CODE>NN_GX_STATE_SCISSOR</CODE></TH><TD>The scissoring state. Commands are generated for scissoring settings. This state is updated when the <CODE>GL_SCISSOR_TEST</CODE> setting is changed by calls to <CODE>glEnable</CODE> or <CODE>glDisable</CODE>; when settings are changed by calls to <CODE>glScissor</CODE>; or when the framebuffer size is changed when scissoring is enabled. 64</TD></TR><TR><TH><CODE>NN_GX_STATE_OTHERS</CODE></TH><TD>This state flag is a state specific to commands generated by functions other than <CODE><a href="../gl/glDrawElements.html">glDrawElements</a></CODE> or <CODE><a href="../gl/glDrawArrays.html">glDrawArrays</a></CODE>. See <I>DMPGL Functions that Generate Commands</I> for reference. 65</TD></TR><TR><TH><CODE>NN_GX_STATE_ALL</CODE></TH><TD>The bitwise AND of all the above <SPAN class="argument">statemask</SPAN> values. 66 </TD></TR></TABLE></P><P> 67This function generates commands when the specified states have been updated. You can use this function in combination with the <CODE><a href="../nn_gx/nngxUpdateState.html">nngxUpdateState</a></CODE> function, which updates states, to generate complete commands related to certain states. 68 </P><P> 69When you use this function to generate commands for individual states, the commands may not be generated in the same order as they originally would have been using the <CODE><a href="../gl/glDrawElements.html">glDrawElements</a></CODE> and <CODE><a href="../gl/glDrawArrays.html">glDrawArrays</a></CODE> functions. Several state flags are dependent on other state flags in various ways, including the order in which the flags are specified. Behavior is undefined when there is a conflict with these dependency restrictions. 70<UL><LI>The state flag <CODE>NN_GX_STATE_FBACCESS</CODE> or <CODE>NN_GX_STATE_TRIOFFSET</CODE> must be specified before or at the same time as this function is called using the state flag <CODE>NN_GX_STATE_FSUNIFORM</CODE>.</LI><LI>The state flag <CODE>NN_GX_STATE_SHADERMODE</CODE> must be specified before or at the same time this function is called using the state flags <CODE>NN_GX_STATE_SHADERBINARY</CODE>, <CODE>NN_GX_STATE_SHADERPROGRAM</CODE>, <CODE>NN_GX_STATE_SHADERFLOAT</CODE>, and <CODE>NN_GX_STATE_VSUNIFORM</CODE>.</LI><LI>The state flags <CODE>NN_GX_STATE_FRAMEBUFFER</CODE> and <CODE>NN_GX_STATE_OTHERS</CODE> must be specified before or at the same time this function is called using the state flag <CODE>NN_GX_STATE_FBACCESS</CODE>.</LI></UL></P><P> 71If the current program object is not set (such as when <CODE>0</CODE> is specified in a call to <CODE>glUseProgram</CODE>), then no commands will be generated even when the states for the program and shader are validated. 72 </P><P> 73This function generates the following errors. 74<TABLE><TR><TH>GL_ERROR_8066_DMP</TH><TD>3D command buffer overflow.</TD></TR><TR><TH>GL_ERROR_806C_DMP</TH><TD>Various DMPGL errors generated during validation.</TD></TR><TR><TH>GL_ERROR_80B2_DMP</TH><TD>3D command buffer not configured (command list not bound).</TD></TR><TR><TH><CODE>GL_ERROR_80B3_DMP</CODE> </TH><TD>When an attempt is made to validate a state related to a program object, in a state where a program object has not been set.</TD></TR></TABLE></P><P> 75When an error occurs during validation, each state is treated as validated. To generate commands properly after an error, call <a href="../nn_gx/nngxUpdateState.html"><CODE>nngxUpdateState</CODE></a> and update each state again. 76 </P><P> 77The detailed occurrence conditions for <CODE>GL_ERROR_80B3_DMP</CODE> are as given below. 78<UL><LI>The <a href="../gl/glUseProgram.html"><CODE>glUseProgram</CODE></a> function has never been called, or else <CODE>0</CODE> was specified for <CODE>program</CODE> when the <CODE>glUseProgram</CODE> function was called.</LI><LI>One of the following bitmasks is specified for <CODE>statemask</CODE>.</LI><UL><LI><CODE>NN_GX_STATE_SHADERBINARY</CODE> </LI><LI><CODE>NN_GX_STATE_SHADERPROGRAM</CODE> </LI><LI><CODE>NN_GX_STATE_SHADERMODE</CODE> </LI><LI><CODE>NN_GX_STATE_SHADERFLOAT</CODE> </LI><LI><CODE>NN_GX_STATE_VSUNIFORM</CODE> </LI><LI><CODE>NN_GX_STATE_FSUNIFORM</CODE> </LI><LI><CODE>NN_GX_STATE_LUT</CODE> </LI><LI><CODE>NN_GX_STATE_VERTEX</CODE> </LI><LI><CODE>NN_GX_STATE_TRIOFFSET</CODE> </LI><LI><CODE>NN_GX_STATE_FBACCESS</CODE> </LI></UL></UL></P></div> 79<h2>See Also</h2> 80 <div class="section"> 81<p class="reference"><a href="../nn_gx/nngxUpdateState.html"><CODE>nngxUpdateState</CODE></a><br /><a href="../nn_gx/nngxInvalidateState.html"><CODE>nngxInvalidateState</CODE></a><br /> </p> 82 </div> 83<h2>Revision History</h2> 84 <div class="section"> 85 <dl class="history"> 86 <dt>2012/05/25</dt> 87<dd>Added the <CODE>GL_ERROR_80B3_DMP</CODE> error code. 88<br /> </dd> 89 <dt>2012/04/25</dt> 90<dd>Added the GL_ERROR_80B2_DMP error code, and added a description of behavior when an error occurs during validation.<br /> 91 </dd> 92 <dt>2012/02/03</dt> 93<dd>Added error codes.<br /> 94 </dd> 95 <dt>2011/10/04</dt> 96<dd>Added <B>See Also</B> section.<br /> 97 </dd> 98 <dt>2011/08/19</dt> 99<dd>Added details about the <SPAN class="argument">statemask</SPAN> parameter. 100 </dd> 101 <dt>2010/07/07</dt> 102<dd>Added description of behavior when the current program object is not set. 103 </dd> 104 <dt>2010/03/12</dt> 105<dd>Initial version.<br /> 106 </dd> 107 </dl> 108 </div> 109 <hr><p>CONFIDENTIAL</p></body> 110</html>