nngxValidateState Function

Syntax

NNGX_APICALL void NNGX_APIENTRY nngxValidateState(
     GLbitfield statemask,
     GLboolean drawelements
);

Parameters

Name Description
in statemask State flag to check (specified as a bitwise OR).
in drawelements Function that performs actual rendering (either glDrawElements or glDrawArrays).

Return Values

There is no return value.

Description

Checks the state and generates commands.

Checks 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 glDrawElements and glDrawArrays functions. DMPGL functions check the state and, if it is updated, generate the relevant commands. This is called validation. With the glDrawElements and glDrawArrays functions, most of the states are all validated at once. With this function, on the other hand, you can validate certain combinations of states.

Set statemask to a bitwise OR of the state flags to validate. Set drawelements to GL_TRUE when glDrawElements is called and to GL_FALSE when glDrawArrays is called for actual rendering. To validate certain states, it is sometimes necessary to know whether glDrawElements or glDrawArrays is used for rendering.

You can input the following values in statemask.

NN_GX_STATE_SHADERBINARYThe shader binary state. Commands are generated for loading shader assembler code. This state is updated when the program is switched by a call to glUseProgram 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 glShaderBinary.
NN_GX_STATE_SHADERPROGRAMThe 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 glUseProgram. 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.
NN_GX_STATE_SHADERMODEThe 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 glUseProgram.
NN_GX_STATE_SHADERFLOATThe shader floating-point state. Commands are generated for setting the floating-point registers for which values are defined by def 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 glUseProgram.
NN_GX_STATE_VSUNIFORMThe 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 glUseProgram, or when the vertex shader uniform values are set by a call to glUniform. 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.
NN_GX_STATE_FSUNIFORMThe 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 glUseProgram, or when the uniform values are changed in the fragment shader uniform setting by a call to glUniform.
NN_GX_STATE_LUTThe 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 glBindTexture, glTexImage1D, or glTexSubImage1D; when the bound lookup table object is deleted by a call to glDeleteTextures; or when the lookup table objects specified by the lookup table ID setting uniforms are changed by calls to glUseProgram or glUniform.
NN_GX_STATE_TEXTUREThe texture state. Commands are generated for the texture unit. This excludes procedural textures. This state is updated when glBindTexture, glTexImage2D, glCompressedTexImage2D, glCopyTexImage2D, glCopyTexSubImage2D, or glTexParameter are called; when the texture object in use is deleted by a call to glDeleteTextures; or when the reserved fragment shader uniform dmp_Texture[i].samplerType is changed by a call to glUseProgram or glUniform.
NN_GX_STATE_FRAMEBUFFERThe framebuffer buffer data state. Commands are generated for the framebuffer format and buffer address. This state is updated when glBindFramebuffer, glBindFramebufferRenderbuffer, glFramebufferTexture2D, glDeleteFramebuffers, glBindRenderbuffer, glRenderbufferStorage, or glDeleteRenderbuffers are called.
NN_GX_STATE_VERTEXThe vertex attribute data state. Commands are generated for the vertex attribute data. This state is updated when glBindBuffer, glBufferData, glBufferSubData, glEnableVertexAttribArray, glDisableVertexAttribArray, glVertexAttribPointer, glVertexAttrib, or glUseProgram are called; or when the current vertex buffer is deleted by a call to glDeleteBuffers.
NN_GX_STATE_TRIOFFSETThe polygon offset state. Commands are generated for the polygon offset. This state is updated when the GL_POLYGON_OFFSET_FILL setting is changed by calls to glEnable or glDisable; when settings are changed by calls to glDepthRangef or glPolygonOffset; or when glUseProgram is called.
NN_GX_STATE_FBACCESSThe framebuffer access method state. Commands are generated for the framebuffer read/write and other access method. This state is updated when the GL_COLOR_LOGIC_OP, GL_BLEND, GL_DEPTH_TEST, GL_EARLY_DEPTH_TEST_DMP, or GL_STENCIL_TEST settings are changed by calls to glEnable or glDisable; when settings are changed by calls to glDepthFunc, glEarlyDepthFuncDMP, glColorMask, glDepthMask, or glStencilMask; or when reserved fragment shader uniform dmp_FragOperation.mode is set by a call to glUniform.
NN_GX_STATE_SCISSORThe scissoring state. Commands are generated for scissoring settings. This state is updated when the GL_SCISSOR_TEST setting is changed by calls to glEnable or glDisable; when settings are changed by calls to glScissor; or when the framebuffer size is changed when scissoring is enabled.
NN_GX_STATE_OTHERSThis state flag is a state specific to commands generated by functions other than glDrawElements or glDrawArrays. See DMPGL Functions that Generate Commands for reference.
NN_GX_STATE_ALLThe bitwise AND of all the above statemask values.

This function generates commands when the specified states have been updated. You can use this function in combination with the nngxUpdateState function, which updates states, to generate complete commands related to certain states.

When 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 glDrawElements and glDrawArrays 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.

If the current program object is not set (such as when 0 is specified in a call to glUseProgram), then no commands will be generated even when the states for the program and shader are validated.

This function generates the following errors.

GL_ERROR_8066_DMP3D command buffer overflow.
GL_ERROR_806C_DMPVarious DMPGL errors generated during validation.
GL_ERROR_80B2_DMP3D command buffer not configured (command list not bound).
GL_ERROR_80B3_DMP 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.

When an error occurs during validation, each state is treated as validated. To generate commands properly after an error, call nngxUpdateState and update each state again.

The detailed occurrence conditions for GL_ERROR_80B3_DMP are as given below.

See Also

nngxUpdateState
nngxInvalidateState

Revision History

2012/05/25
Added the GL_ERROR_80B3_DMP error code.
2012/04/25
Added the GL_ERROR_80B2_DMP error code, and added a description of behavior when an error occurs during validation.
2012/02/03
Added error codes.
2011/10/04
Added See Also section.
2011/08/19
Added details about the statemask parameter.
2010/07/07
Added description of behavior when the current program object is not set.
2010/03/12
Initial version.

CONFIDENTIAL