Using GPU Commands and GL Together

Introduction
Maintaining Consistency of Internal States When DMPGL API Mixed with Directly Generated Commands
Moving Between DMPGL API Calls and Directly Generated Commands
Notes

Introduction

This document is a collection of notes regarding the methods of generating commands that can be directly interpreted by the GPU and the use of those commands together with DMPGL.

If you need more information about the direct generation of commands, see the following documentation:

Maintaining Consistency of Internal States When DMPGL API Mixed with Directly Generated Commands

Assumptions:

Command Issuance by the DMPGL Driver

The Timing of Internal State Updating

Basically speaking, when a DMPGL API function is called that requires state updating, if it is possible to compare and confirm the updating of the current internal state, then the actual process of updating the internal state is carried out and the state update flag is raised.

→ In other words, when commands are directly generated without using the DMPGL API, they must not issue an update the internal state.

For the DMPGL API functions belonging to NN_GX_STATE_OTHERS, if there is an update to the internal state a command is issued and afterward the internal state is updated. (The exception is glViewport, where the command is issued without making the comparison with the internal state.)

For the API functions listed below, the update flag stands for the dependent state (NN_GX_STATE_FACES).

Moving Between DMPGL API Calls and Directly Generated Commands

How to Safely Move From Calls to DMPGL API Functions to Direct Generation of Commands

How to Safely Move From Direct Generation of Commands to Calls to DMPGL API Functions

Due to the direct generation of commands, the register settings in the GPU and the internal states maintained in the DMPG driver layer may not be exactly the same.

In order for the GPU to correctly process the results of calls to the DMPGL API, the two must be made to match.

Broadly speaking, there are two ways of doing this before moving to the call of DMPGL API functions.

  1. Issue commands to force the updating of all states. In other words, specify nngxUpdateState(NN_GX_STATE_ALL) and validate. This is the surest way, but you also end up issuing unnecessary commands (for registers that have already been overwritten).
  2. If the directly generated commands have been already clearly divided out, forcedly raise the update flag for just the states that pertain to those commands, and then validate. This method minimizes the issuance of commands, but the application needs to manage which states pertain to which directly generated commands and whether there are any dependent states.

You can modify method (2) to suppress the redundant issuance of commands. By defining nngxSetCommandGenerationMode(NN_GX_CMDGEN_MODE_UNCONDITIONAL), commands will be issued regardless of the result of the comparison with the internal state. However, the influence of this mode is limited to the following settings. (For details, see section 4.10 in the specifications.)

To update the state flags relating to these settings, it is no longer necessary to use nngxUpdateState.

Notes

Other notes regarding the NN_GX_STATE_OTHERS state.

When Creating Command Cache

About Command Output Mode

By specifying NN_GX_CMDGEN_MODE_UNCONDITIONAL with nngxSetCommandGenerationMode before calling the pertinent API function, the command will be issued regardless of the result of the comparison with the internal state.

The Behavior of nngxUseSavedCmdlist and nngxUpdateState(NN_GX_STATE_OTHERS)

If NN_GX_STATE_OTHERS has been specified for the statemask argument, the commands will be issued all at once at validation time for all API functions that result in command issuance when they themselves are called. In addition, the update bit will raise automatically for the dependent state NN_GX_STATE_FBACCESS.


CONFIDENTIAL